diff options
author | KWSys Upstream <kwrobot@kitware.com> | 2017-12-15 15:48:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-12-15 15:48:13 (GMT) |
commit | 86399e49398cc9e8028e280eee3e89992ab3fd11 (patch) | |
tree | ef2bcbd2ca3955d44a2e954961b5a3ed1e35de31 | |
parent | c6a83ecf1761eea8d0907ea9d8913fe56029a00d (diff) | |
download | CMake-86399e49398cc9e8028e280eee3e89992ab3fd11.zip CMake-86399e49398cc9e8028e280eee3e89992ab3fd11.tar.gz CMake-86399e49398cc9e8028e280eee3e89992ab3fd11.tar.bz2 |
KWSys 2017-12-15 (8f755ee9)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit 8f755ee93451e580aa7b5ed6cee9e6c5da81e7d0 (master).
Upstream Shortlog
-----------------
Volo Zyko (1):
9f6cd407 SystemTools: Fix removing of soft links to directories on Windows.
-rw-r--r-- | SystemTools.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx index 649f30b..f547362 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2509,6 +2509,14 @@ bool SystemTools::RemoveFile(const std::string& source) if (IsJunction(ws) && DeleteJunction(ws)) { return true; } + const DWORD DIRECTORY_SOFT_LINK_ATTRS = + FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT; + DWORD attrs = GetFileAttributesW(ws.c_str()); + if (attrs != INVALID_FILE_ATTRIBUTES && + (attrs & DIRECTORY_SOFT_LINK_ATTRS) == DIRECTORY_SOFT_LINK_ATTRS && + RemoveDirectoryW(ws.c_str())) { + return true; + } if (DeleteFileW(ws.c_str()) || GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_PATH_NOT_FOUND) { return true; |