DetachedSong: allow LoadFile(), Update() to throw
This commit is contained in:
parent
3fc4da382e
commit
9a78371b5c
@ -135,10 +135,10 @@ Song::UpdateFileInArchive(ArchiveFile &archive) noexcept
|
||||
#endif
|
||||
|
||||
bool
|
||||
DetachedSong::LoadFile(Path path) noexcept
|
||||
DetachedSong::LoadFile(Path path)
|
||||
{
|
||||
FileInfo fi;
|
||||
if (!GetFileInfo(path, fi) || !fi.IsRegular())
|
||||
const FileInfo fi(path);
|
||||
if (!fi.IsRegular())
|
||||
return false;
|
||||
|
||||
TagBuilder tag_builder;
|
||||
@ -151,13 +151,11 @@ DetachedSong::LoadFile(Path path) noexcept
|
||||
}
|
||||
|
||||
bool
|
||||
DetachedSong::Update() noexcept
|
||||
DetachedSong::Update()
|
||||
{
|
||||
if (IsAbsoluteFile()) {
|
||||
const AllocatedPath path_fs =
|
||||
AllocatedPath::FromUTF8(GetRealURI());
|
||||
if (path_fs.IsNull())
|
||||
return false;
|
||||
AllocatedPath::FromUTF8Throw(GetRealURI());
|
||||
|
||||
return LoadFile(path_fs);
|
||||
} else if (IsRemote()) {
|
||||
|
@ -234,14 +234,18 @@ public:
|
||||
/**
|
||||
* Update the #tag and #mtime.
|
||||
*
|
||||
* Throws on error.
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool Update() noexcept;
|
||||
bool Update();
|
||||
|
||||
/**
|
||||
* Load #tag and #mtime from a local file.
|
||||
*
|
||||
* Throws on error.
|
||||
*/
|
||||
bool LoadFile(Path path) noexcept;
|
||||
bool LoadFile(Path path);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -96,7 +96,7 @@ DatabaseDetachSong(gcc_unused const Database &db,
|
||||
}
|
||||
|
||||
bool
|
||||
DetachedSong::LoadFile(Path path) noexcept
|
||||
DetachedSong::LoadFile(Path path)
|
||||
{
|
||||
if (path.ToUTF8() == uri1) {
|
||||
SetTag(MakeTag1a());
|
||||
|
Loading…
Reference in New Issue
Block a user