build: prevent data loss when a CMakeCache.txt is in the root directory
This commit is contained in:
3
ns3
3
ns3
@@ -430,7 +430,8 @@ def print_and_buffer(message):
|
|||||||
def remove_dir(dir_to_remove, dry_run, directory_qualifier=""):
|
def remove_dir(dir_to_remove, dry_run, directory_qualifier=""):
|
||||||
dir_to_remove = os.path.abspath(dir_to_remove)
|
dir_to_remove = os.path.abspath(dir_to_remove)
|
||||||
if os.path.exists(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
|
# In case the directory to remove isn't within
|
||||||
# the current ns-3 directory, print an error
|
# the current ns-3 directory, print an error
|
||||||
# message for the dry-run case
|
# message for the dry-run case
|
||||||
|
|||||||
Reference in New Issue
Block a user