| 53 | } |
| 54 | |
| 55 | bool WinRemove(const TString& path) { |
| 56 | TUtf16String wstr; |
| 57 | LPCWSTR wname = UTF8ToWCHAR(path, wstr); |
| 58 | if (!wname) { |
| 59 | ::SetLastError(ERROR_INVALID_NAME); |
| 60 | return false; |
| 61 | } |
| 62 | WIN32_FILE_ATTRIBUTE_DATA fad; |
| 63 | if (::GetFileAttributesExW(wname, GetFileExInfoStandard, &fad)) { |
| 64 | if (fad.dwFileAttributes & FILE_ATTRIBUTE_READONLY) { |
| 65 | fad.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; |
| 66 | ::SetFileAttributesW(wname, fad.dwFileAttributes); |
| 67 | } |
| 68 | if (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { |
| 69 | return ::RemoveDirectoryW(wname) != 0; |
| 70 | } |
| 71 | return ::DeleteFileW(wname) != 0; |
| 72 | } |
| 73 | |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | bool WinSymLink(const TString& targetName, const TString& linkName) { |
| 78 | TString tName(targetName); |
no test coverage detected