From f123367254c4737981af3e0641e5a4f388d0567d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 13 Feb 2013 10:00:50 -0500 Subject: [PATCH] file: Do not remove symlinked directories recursively (#10538) If a symlink points at a directory the symlink should be removed but not the content of the directory. --- Source/cmFileCommand.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0cdbb82d7..018ce7ecd 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2409,7 +2409,8 @@ bool cmFileCommand::HandleRemove(std::vector const& args, fileName += "/" + *i; } - if(cmSystemTools::FileIsDirectory(fileName.c_str()) && recurse) + if(cmSystemTools::FileIsDirectory(fileName.c_str()) && + !cmSystemTools::FileIsSymlink(fileName.c_str()) && recurse) { cmSystemTools::RemoveADirectory(fileName.c_str()); }