mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
KWSys 2023-11-29 (433f3d23)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit 433f3d23ffa37f8fa6dd42468933f36c28a9e7fa (master).
Upstream Shortlog
-----------------
Brad King (1):
9f9ff427 SystemTools: Teach RemoveADirectory to handle non-readable directories
This commit is contained in:
committed by
Brad King
parent
09b90d4377
commit
22a759b5b5
@@ -2794,14 +2794,14 @@ Status SystemTools::RemoveFile(std::string const& source)
|
||||
|
||||
Status SystemTools::RemoveADirectory(std::string const& source)
|
||||
{
|
||||
// Add write permission to the directory so we can modify its
|
||||
// content to remove files and directories from it.
|
||||
// Add read and write permission to the directory so we can read
|
||||
// and modify its content to remove files and directories from it.
|
||||
mode_t mode = 0;
|
||||
if (SystemTools::GetPermissions(source, mode)) {
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
mode |= S_IWRITE;
|
||||
mode |= S_IREAD | S_IWRITE;
|
||||
#else
|
||||
mode |= S_IWUSR;
|
||||
mode |= S_IRUSR | S_IWUSR;
|
||||
#endif
|
||||
SystemTools::SetPermissions(source, mode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user