summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp6
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());