diff options
author | Max Kellermann <max@duempel.org> | 2015-02-25 19:13:58 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-02-25 19:53:35 +0100 |
commit | e3908c8de6645b2a7577b47cb5c5e76c7c0b24be (patch) | |
tree | 01f6aab7dc783a57c1cc87e47fa221af9b093a28 /src | |
parent | 81c49fba031ba9071817e7e563c006ea637330b7 (diff) | |
download | mpd-e3908c8de6645b2a7577b47cb5c5e76c7c0b24be.tar.gz mpd-e3908c8de6645b2a7577b47cb5c5e76c7c0b24be.tar.xz mpd-e3908c8de6645b2a7577b47cb5c5e76c7c0b24be.zip |
fs/Traits: add constant CURRENT_DIRECTORY
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/CheckFile.cxx | 3 | ||||
-rw-r--r-- | src/fs/Traits.cxx | 2 | ||||
-rw-r--r-- | src/fs/Traits.hxx | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/fs/CheckFile.cxx b/src/fs/CheckFile.cxx index 3f44e8397..bd1798094 100644 --- a/src/fs/CheckFile.cxx +++ b/src/fs/CheckFile.cxx @@ -47,7 +47,8 @@ CheckDirectoryReadable(Path path_fs) } #ifndef WIN32 - const auto x = AllocatedPath::Build(path_fs, "."); + const auto x = AllocatedPath::Build(path_fs, + PathTraitsFS::CURRENT_DIRECTORY); if (!StatFile(x, st) && errno == EACCES) FormatError(config_domain, "No permission to traverse (\"execute\") directory: %s", diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx index 4c8d7012c..225a6ee71 100644 --- a/src/fs/Traits.cxx +++ b/src/fs/Traits.cxx @@ -74,7 +74,7 @@ GetParentPathImpl(typename Traits::const_pointer p) typename Traits::const_pointer sep = Traits::FindLastSeparator(p); if (sep == nullptr) - return typename Traits::string("."); + return typename Traits::string(Traits::CURRENT_DIRECTORY); if (sep == p) return typename Traits::string(p, p + 1); #ifdef WIN32 diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx index 1b5e1e6f8..f00765570 100644 --- a/src/fs/Traits.hxx +++ b/src/fs/Traits.hxx @@ -47,6 +47,8 @@ struct PathTraitsFS { static constexpr value_type SEPARATOR = '/'; #endif + static constexpr const_pointer CURRENT_DIRECTORY = "."; + static constexpr bool IsSeparator(value_type ch) { return #ifdef WIN32 @@ -149,6 +151,8 @@ struct PathTraitsUTF8 { static constexpr value_type SEPARATOR = '/'; + static constexpr const_pointer CURRENT_DIRECTORY = "."; + static constexpr bool IsSeparator(value_type ch) { return ch == SEPARATOR; } |