mirror of
https://github.com/reactos/CMake.git
synced 2024-12-11 13:24:58 +00:00
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.
This commit is contained in:
parent
c6a83ecf17
commit
86399e4939
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user