fs/FileSystem: RemoveFile() throws exception on error

This commit is contained in:
Max Kellermann
2016-08-15 22:25:15 +02:00
parent 14d3da0e18
commit ea0e6d9824
8 changed files with 48 additions and 22 deletions

View File

@@ -321,8 +321,15 @@ spl_delete(const char *name_utf8)
const auto path_fs = spl_map_to_fs(name_utf8);
assert(!path_fs.IsNull());
if (!RemoveFile(path_fs))
ThrowPlaylistErrno();
try {
RemoveFile(path_fs);
} catch (const std::system_error &e) {
if (IsFileNotFound(e))
throw PlaylistError(PlaylistResult::NO_SUCH_LIST,
"No such playlist");
else
throw;
}
idle_add(IDLE_STORED_PLAYLIST);
}