aboutsummaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 19:01:06 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 19:09:28 +0100
commitffd16b55a69a01b906805752acc11e26491138bc (patch)
treeeae175525c3691e87c348bc107f903e61302cf69 /src/db
parentd744c997d8a4370d56901c5bdf92d3cca0ef83bc (diff)
downloadmpd-ffd16b55a69a01b906805752acc11e26491138bc.tar.gz
mpd-ffd16b55a69a01b906805752acc11e26491138bc.tar.xz
mpd-ffd16b55a69a01b906805752acc11e26491138bc.zip
StoragePlugin: add method MapToRelativeUTF8()
Replaces map_to_relative_path() from Mapper.cxx.
Diffstat (limited to 'src/db')
-rw-r--r--src/db/update/Walk.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx
index 0ea1eb450..8acabe7ea 100644
--- a/src/db/update/Walk.cxx
+++ b/src/db/update/Walk.cxx
@@ -29,13 +29,13 @@
#include "db/Uri.hxx"
#include "storage/StorageInterface.hxx"
#include "playlist/PlaylistRegistry.hxx"
-#include "Mapper.hxx"
#include "ExcludeList.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
+#include "fs/Charset.hxx"
#include "storage/FileInfo.hxx"
#include "util/Alloc.hxx"
#include "util/UriUtil.hxx"
@@ -274,8 +274,13 @@ UpdateWalk::SkipSymlink(const Directory *directory,
if (PathTraitsFS::IsAbsolute(target_str)) {
/* if the symlink points to an absolute path, see if
that path is inside the music directory */
- const char *relative = map_to_relative_path(target_str);
- return relative > target_str
+ const auto target_utf8 = PathToUTF8(target_str);
+ if (target_utf8.empty())
+ return true;
+
+ const char *relative =
+ storage.MapToRelativeUTF8(target_utf8.c_str());
+ return relative != nullptr
? !follow_inside_symlinks
: !follow_outside_symlinks;
}