diff options
Diffstat (limited to '')
-rw-r--r-- | src/Mapper.cxx | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/Mapper.cxx b/src/Mapper.cxx index 4e7efff67..5a02096e8 100644 --- a/src/Mapper.cxx +++ b/src/Mapper.cxx @@ -193,73 +193,6 @@ map_uri_fs(const char *uri) return AllocatedPath::Build(music_dir_fs, uri_fs); } -gcc_pure -static AllocatedPath -map_directory_fs(const Directory &directory) -{ - assert(!music_dir_fs.IsNull()); - - if (directory.IsRoot()) - return music_dir_fs; - - return map_uri_fs(directory.GetPath()); -} - -/** - * Determines the file system path of a directory's child (may be a - * sub directory or a song). - * - * @param directory the parent directory object - * @param name the child's name in UTF-8 - * @return the path in file system encoding, or nullptr if mapping failed - */ -static AllocatedPath -map_directory_child_fs(const Directory &directory, const char *name) -{ - assert(!music_dir_fs.IsNull()); - - /* check for invalid or unauthorized base names */ - if (*name == 0 || strchr(name, '/') != nullptr || - strcmp(name, ".") == 0 || strcmp(name, "..") == 0) - return AllocatedPath::Null(); - - const auto parent_fs = map_directory_fs(directory); - if (parent_fs.IsNull()) - return AllocatedPath::Null(); - - const auto name_fs = AllocatedPath::FromUTF8(name); - if (name_fs.IsNull()) - return AllocatedPath::Null(); - - return AllocatedPath::Build(parent_fs, name_fs); -} - -AllocatedPath -map_song_fs(const Song &song) -{ - assert(song.parent != nullptr); - - return map_directory_child_fs(*song.parent, song.uri); -} - -#endif - -AllocatedPath -map_song_fs(const DetachedSong &song) -{ - if (song.IsAbsoluteFile()) - return AllocatedPath::FromUTF8(song.GetRealURI()); - else { -#ifdef ENABLE_DATABASE - return map_uri_fs(song.GetURI()); -#else - return AllocatedPath::Null(); -#endif - } -} - -#ifdef ENABLE_DATABASE - std::string map_fs_to_utf8(const char *path_fs) { |