fs/io/FileOutputStream: use C++ exceptions in Commit()

This commit is contained in:
Max Kellermann
2015-12-16 00:24:41 +01:00
parent 24b2198668
commit 7eae3bc8c5
8 changed files with 61 additions and 44 deletions

View File

@@ -239,7 +239,11 @@ SavePlaylistFile(const PlaylistFileContents &contents, const char *utf8path,
for (const auto &uri_utf8 : contents)
playlist_print_uri(bos, uri_utf8.c_str());
return bos.Flush(error) && fos.Commit(error);
if (!bos.Flush(error))
return false;
fos.Commit();
return true;
}
PlaylistFileContents
@@ -411,9 +415,11 @@ spl_append_song(const char *utf8path, const DetachedSong &song, Error &error)
playlist_print_song(bos, song);
if (!bos.Flush(error) || !fos.Commit(error))
if (!bos.Flush(error))
return false;
fos.Commit();
idle_add(IDLE_STORED_PLAYLIST);
return true;
}