diff options
Diffstat (limited to 'src/buildtool/file_system/file_system_manager.hpp')
-rw-r--r-- | src/buildtool/file_system/file_system_manager.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp index 528d50ca..146e6dbf 100644 --- a/src/buildtool/file_system/file_system_manager.hpp +++ b/src/buildtool/file_system/file_system_manager.hpp @@ -1065,6 +1065,12 @@ class FileSystemManager { if (std::filesystem::is_symlink(src)) { return false; } + // Check that src and dst point to different filesystem entities: + if (std::filesystem::weakly_canonical(src) == + std::filesystem::weakly_canonical(dst)) { + return true; + } + if (not RemoveFile(dst)) { Logger::Log( LogLevel::Error, "cannot remove file {}", dst.string()); |