fs/AllocatedPath: divert some methods to class Path

Eliminate duplicate code.
This commit is contained in:
Max Kellermann 2018-07-18 16:38:57 +02:00
parent 6448b31b11
commit f87265a4d5
2 changed files with 6 additions and 18 deletions

View File

@ -52,22 +52,6 @@ AllocatedPath::FromUTF8Throw(const char *path_utf8)
#endif
}
AllocatedPath
AllocatedPath::GetDirectoryName() const noexcept
{
return FromFS(PathTraitsFS::GetParent(c_str()));
}
std::string
AllocatedPath::ToUTF8() const noexcept
{
try {
return ::PathToUTF8(c_str());
} catch (...) {
return std::string();
}
}
void
AllocatedPath::ChopSeparators() noexcept
{

View File

@ -249,14 +249,18 @@ public:
* (#IsNull returns true).
*/
gcc_pure
std::string ToUTF8() const noexcept;
std::string ToUTF8() const noexcept {
return ((Path)*this).ToUTF8();
}
/**
* Gets directory name of this path.
* Returns a "nulled" instance on error.
*/
gcc_pure
AllocatedPath GetDirectoryName() const noexcept;
AllocatedPath GetDirectoryName() const noexcept {
return ((Path)*this).GetDirectoryName();
}
/**
* Determine the relative part of the given path to this