diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /util/system/fs_win.cpp | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz |
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'util/system/fs_win.cpp')
-rw-r--r-- | util/system/fs_win.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp index ff8a254782..65e695bee4 100644 --- a/util/system/fs_win.cpp +++ b/util/system/fs_win.cpp @@ -12,8 +12,9 @@ namespace NFsPrivate { static LPCWSTR UTF8ToWCHAR(const TStringBuf str, TUtf16String& wstr) { wstr.resize(str.size()); size_t written = 0; - if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written)) + if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written)) { return nullptr; + } wstr.erase(written); static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)"); return (const WCHAR*)wstr.data(); @@ -64,8 +65,9 @@ namespace NFsPrivate { fad.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; ::SetFileAttributesW(wname, fad.dwFileAttributes); } - if (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + if (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { return ::RemoveDirectoryW(wname) != 0; + } return ::DeleteFileW(wname) != 0; } @@ -76,8 +78,9 @@ namespace NFsPrivate { TString tName(targetName); { size_t pos; - while ((pos = tName.find('/')) != TString::npos) + while ((pos = tName.find('/')) != TString::npos) { tName.replace(pos, 1, LOCSLASH_S); + } } TUtf16String tstr; LPCWSTR wname = UTF8ToWCHAR(tName, tstr); @@ -127,8 +130,9 @@ namespace NFsPrivate { TTempBuf result; LPWSTR buf = reinterpret_cast<LPWSTR>(result.Data()); int r = GetCurrentDirectoryW(result.Size() / sizeof(WCHAR), buf); - if (r == 0) + if (r == 0) { throw TIoSystemError() << "failed to GetCurrentDirectory"; + } return WCHARToUTF8(buf, r); } |