StoragePlugin: add method MapToRelativeUTF8()

Replaces map_to_relative_path() from Mapper.cxx.
This commit is contained in:
Max Kellermann
2014-02-07 19:01:06 +01:00
parent d744c997d8
commit ffd16b55a6
10 changed files with 60 additions and 55 deletions

View File

@@ -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;
}