MCPcopy Create free account
hub / github.com/catboost/catboost / WinRemove

Function WinRemove

util/system/fs_win.cpp:55–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers 2

RemoveMethod · 0.85
Y_UNIT_TESTFunction · 0.85

Calls 1

UTF8ToWCHARFunction · 0.70

Tested by

no test coverage detected