From 781e37e40cb9f642e71fd293840671c7ec100dea Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Sat, 26 Aug 2023 23:42:03 -0300 Subject: [PATCH] build: prevent data loss when a CMakeCache.txt is in the root directory --- ns3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ns3 b/ns3 index 270f07c8d..296ca4375 100755 --- a/ns3 +++ b/ns3 @@ -430,7 +430,8 @@ def print_and_buffer(message): def remove_dir(dir_to_remove, dry_run, directory_qualifier=""): dir_to_remove = os.path.abspath(dir_to_remove) if os.path.exists(dir_to_remove): - if ".." in os.path.relpath(dir_to_remove, ns3_path): + if (".." in os.path.relpath(dir_to_remove, ns3_path) + or os.path.abspath(dir_to_remove) == os.path.abspath(ns3_path)): # In case the directory to remove isn't within # the current ns-3 directory, print an error # message for the dry-run case