fs/FileSystem, ...: use AllocatedPath::FromFS(string_view)
This commit is contained in:
parent
91c75a133f
commit
56b4b010d6
@ -55,8 +55,7 @@ ReadLink(Path path)
|
|||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
buffer[size] = '\0';
|
return AllocatedPath::FromFS(std::string_view{buffer, size_t(size)});
|
||||||
return AllocatedPath::FromFS(buffer);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ LookupFile(Path pathname)
|
|||||||
//its a file ?
|
//its a file ?
|
||||||
if (file_info.IsRegular()) {
|
if (file_info.IsRegular()) {
|
||||||
//so the upper should be file
|
//so the upper should be file
|
||||||
return {AllocatedPath::FromFS(buffer.c_str()), AllocatedPath::FromFS(slash + 1)};
|
return {AllocatedPath::FromFS(buffer), AllocatedPath::FromFS(slash + 1)};
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ AcpToAllocatedPath(const char *s)
|
|||||||
if (result <= 0)
|
if (result <= 0)
|
||||||
throw MakeLastError("MultiByteToWideChar() failed");
|
throw MakeLastError("MultiByteToWideChar() failed");
|
||||||
|
|
||||||
return AllocatedPath::FromFS(buffer);
|
return AllocatedPath::FromFS(std::wstring_view(buffer, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
FromNarrowPath::FromNarrowPath(const char *s)
|
FromNarrowPath::FromNarrowPath(const char *s)
|
||||||
|
@ -303,7 +303,7 @@ GetAppBaseDir() noexcept
|
|||||||
if (ret == app.size() && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
if (ret == app.size() && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto app_path = AllocatedPath::FromFS(app.data());
|
auto app_path = AllocatedPath::FromFS(PathTraitsFS::string_view(app.data(), ret));
|
||||||
return app_path.GetDirectoryName().GetDirectoryName();
|
return app_path.GetDirectoryName().GetDirectoryName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user