aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/Path.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-01 18:35:37 +0200
committerMax Kellermann <max@duempel.org>2013-10-02 08:56:27 +0200
commit43675717b83b8502dcf7a2254195f771c50d8cec (patch)
tree4816eda1f2caa59ec3bb9a353704e9244375e883 /src/fs/Path.cxx
parentb21ed2fa3673cf2fbdc4142c07d60c499e5f877e (diff)
downloadmpd-43675717b83b8502dcf7a2254195f771c50d8cec.tar.gz
mpd-43675717b83b8502dcf7a2254195f771c50d8cec.tar.xz
mpd-43675717b83b8502dcf7a2254195f771c50d8cec.zip
filesystem/Path: use std::string
Diffstat (limited to 'src/fs/Path.cxx')
-rw-r--r--src/fs/Path.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/fs/Path.cxx b/src/fs/Path.cxx
index f04823661..9fdb78d35 100644
--- a/src/fs/Path.cxx
+++ b/src/fs/Path.cxx
@@ -52,6 +52,20 @@ const Domain path_domain("path");
std::string fs_charset;
+inline Path::Path(Donate, pointer _value)
+ :value(_value) {
+ g_free(_value);
+}
+
+/* no inlining, please */
+Path::~Path() {}
+
+Path
+Path::Build(const_pointer a, const_pointer b)
+{
+ return Path(Donate(), g_build_filename(a, b, nullptr));
+}
+
std::string Path::ToUTF8(const_pointer path_fs)
{
if (path_fs == nullptr)
@@ -102,6 +116,12 @@ Path::FromUTF8(const char *path_utf8, Error &error)
return path;
}
+Path
+Path::GetDirectoryName() const
+{
+ return Path(Donate(), g_path_get_dirname(value.c_str()));
+}
+
gcc_pure
static bool
IsSupportedCharset(const char *charset)