[Filesystem] Improve exception message for copy method

This commit is contained in:
Thomas Schulz 2015-02-14 22:36:49 +01:00 committed by Fabien Potencier
parent 4c767e64b2
commit 021206c0ac

View File

@ -72,8 +72,8 @@ class Filesystem
// Like `cp`, preserve executable permission bits // Like `cp`, preserve executable permission bits
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111)); @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
if (stream_is_local($originFile) && $bytesCopied !== filesize($originFile)) { if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s %g bytes copied".', $originFile, $targetFile, $bytesCopied), 0, null, $originFile); throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
} }
} }
} }