mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 01:45:36 +08:00
Fix file copy operation to handle identical source and destination paths
This commit is contained in:
@@ -142,6 +142,9 @@ class FileSystem
|
|||||||
logger()->debug("Copying file from {$from} to {$to}");
|
logger()->debug("Copying file from {$from} to {$to}");
|
||||||
$dst_path = FileSystem::convertPath($to);
|
$dst_path = FileSystem::convertPath($to);
|
||||||
$src_path = FileSystem::convertPath($from);
|
$src_path = FileSystem::convertPath($from);
|
||||||
|
if ($src_path === $dst_path) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!copy($src_path, $dst_path)) {
|
if (!copy($src_path, $dst_path)) {
|
||||||
throw new FileSystemException('Cannot copy file from ' . $src_path . ' to ' . $dst_path);
|
throw new FileSystemException('Cannot copy file from ' . $src_path . ' to ' . $dst_path);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user