diff options
Diffstat (limited to 'src/fs/Traits.cxx')
-rw-r--r-- | src/fs/Traits.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx index 166b31f4e..7eba0916a 100644 --- a/src/fs/Traits.cxx +++ b/src/fs/Traits.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2014 The Music Player Daemon Project + * Copyright (C) 2003-2015 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,6 +19,7 @@ #include "config.h" #include "Traits.hxx" +#include "util/StringUtil.hxx" #include <string.h> @@ -74,7 +75,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 @@ -92,13 +93,12 @@ RelativePathImpl(typename Traits::const_pointer base, assert(base != nullptr); assert(other != nullptr); - const auto base_length = Traits::GetLength(base); - if (memcmp(base, other, base_length * sizeof(*base)) != 0) + other = StringAfterPrefix(other, base); + if (other == nullptr) /* mismatch */ return nullptr; - other += base_length; - if (other != 0) { + if (*other != 0) { if (!Traits::IsSeparator(*other)) /* mismatch */ return nullptr; |