Trim trainling slashes in the parameter of CreateDirectoryFromAppW.
This commit is contained in:
parent
d2f575fc1c
commit
7c4ff60f79
@ -394,6 +394,9 @@ Status WalkPath::do_run(CSlice path, const detail::WalkFunction &func) {
|
||||
|
||||
Status mkdir(CSlice dir, int32 mode) {
|
||||
TRY_RESULT(wdir, to_wstring(dir));
|
||||
while (!wdir.empty() && (wdir.back() == L'/' || wdir.back() == L'\\')) {
|
||||
wdir.pop_back();
|
||||
}
|
||||
auto status = td::CreateDirectoryFromAppW(wdir.c_str(), nullptr);
|
||||
if (status == 0 && GetLastError() != ERROR_ALREADY_EXISTS) {
|
||||
return OS_ERROR(PSLICE() << "Can't create directory \"" << dir << '"');
|
||||
|
Loading…
Reference in New Issue
Block a user