SongUpdate: pass Storage to UpdateFileInArchive()

This commit is contained in:
Max Kellermann 2014-02-07 18:38:16 +01:00
parent 3341b282b7
commit 4ab4cf8532
2 changed files with 6 additions and 5 deletions

View File

@ -25,7 +25,6 @@
#include "storage/FileInfo.hxx" #include "storage/FileInfo.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "Mapper.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx" #include "fs/Traits.hxx"
#include "fs/FileSystem.hxx" #include "fs/FileSystem.hxx"
@ -54,7 +53,7 @@ Song::LoadFile(Storage &storage, const char *path_utf8, Directory &parent)
//in archive ? //in archive ?
bool success = parent.device == DEVICE_INARCHIVE bool success = parent.device == DEVICE_INARCHIVE
? song->UpdateFileInArchive() ? song->UpdateFileInArchive(storage)
: song->UpdateFile(storage); : song->UpdateFile(storage);
if (!success) { if (!success) {
song->Free(); song->Free();
@ -115,7 +114,7 @@ Song::UpdateFile(Storage &storage)
} }
bool bool
Song::UpdateFileInArchive() Song::UpdateFileInArchive(const Storage &storage)
{ {
/* check if there's a suffix and a plugin */ /* check if there's a suffix and a plugin */
@ -126,7 +125,9 @@ Song::UpdateFileInArchive()
if (!decoder_plugins_supports_suffix(suffix)) if (!decoder_plugins_supports_suffix(suffix))
return false; return false;
const auto path_fs = map_song_fs(*this); const auto path_fs = parent->IsRoot()
? storage.MapFS(uri)
: storage.MapChildFS(parent->GetPath(), uri);
if (path_fs.IsNull()) if (path_fs.IsNull())
return false; return false;

View File

@ -98,7 +98,7 @@ struct Song {
void Free(); void Free();
bool UpdateFile(Storage &storage); bool UpdateFile(Storage &storage);
bool UpdateFileInArchive(); bool UpdateFileInArchive(const Storage &storage);
/** /**
* Returns the URI of the song in UTF-8 encoding, including its * Returns the URI of the song in UTF-8 encoding, including its