Commit f87265a4 authored by Max Kellermann's avatar Max Kellermann

fs/AllocatedPath: divert some methods to class Path

Eliminate duplicate code.
parent 6448b31b
...@@ -52,22 +52,6 @@ AllocatedPath::FromUTF8Throw(const char *path_utf8) ...@@ -52,22 +52,6 @@ AllocatedPath::FromUTF8Throw(const char *path_utf8)
#endif #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 void
AllocatedPath::ChopSeparators() noexcept AllocatedPath::ChopSeparators() noexcept
{ {
......
...@@ -249,14 +249,18 @@ public: ...@@ -249,14 +249,18 @@ public:
* (#IsNull returns true). * (#IsNull returns true).
*/ */
gcc_pure gcc_pure
std::string ToUTF8() const noexcept; std::string ToUTF8() const noexcept {
return ((Path)*this).ToUTF8();
}
/** /**
* Gets directory name of this path. * Gets directory name of this path.
* Returns a "nulled" instance on error. * Returns a "nulled" instance on error.
*/ */
gcc_pure gcc_pure
AllocatedPath GetDirectoryName() const noexcept; AllocatedPath GetDirectoryName() const noexcept {
return ((Path)*this).GetDirectoryName();
}
/** /**
* Determine the relative part of the given path to this * Determine the relative part of the given path to this
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment