summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-04-17 17:50:08 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2025-04-22 13:50:57 +0200
commitba51f59519847a3d298fd176d93a0b6c64f452c1 (patch)
tree8bc88ef09ab66c9b57e35b3c346eb31c2450d657 /src
parent3b744b7a5e365caa1b0efde7a530c95dccf10a8f (diff)
downloadjustbuild-ba51f59519847a3d298fd176d93a0b6c64f452c1.tar.gz
FileSystemManager: When copying, take into account equivalent files.
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());