summaryrefslogtreecommitdiff
path: root/src/StateFile.cxx
diff options
context:
space:
mode:
authorFlashSystems <developer@flashsystems.de>2017-11-25 11:20:32 +0100
committerMax Kellermann <max@musicpd.org>2017-12-18 23:39:01 +0100
commit64d141f71e690a4258ba9ee8712140bc9d961883 (patch)
tree234ab717117fbefcd8317dafe4ee6eec7a85ff75 /src/StateFile.cxx
parentc488d3123f33fe28525c2b8b229aaae2f9d4dc06 (diff)
Save and restore mountpoints within the state file.
Signed-off-by: FlashSystems <developer@flashsystems.de>
Diffstat (limited to 'src/StateFile.cxx')
-rw-r--r--src/StateFile.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/StateFile.cxx b/src/StateFile.cxx
index cc02d0ff7..e8cf7d11a 100644
--- a/src/StateFile.cxx
+++ b/src/StateFile.cxx
@@ -24,6 +24,7 @@
#include "fs/io/TextFile.hxx"
#include "fs/io/FileOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
+#include "storage/StorageState.hxx"
#include "Partition.hxx"
#include "Instance.hxx"
#include "mixer/Volume.hxx"
@@ -56,6 +57,9 @@ StateFile::RememberVersions() noexcept
prev_output_version = audio_output_state_get_version();
prev_playlist_version = playlist_state_get_hash(partition.playlist,
partition.pc);
+#ifdef ENABLE_DATABASE
+ prev_storage_version = storage_state_get_hash(partition.instance);
+#endif
}
bool
@@ -64,7 +68,11 @@ StateFile::IsModified() const noexcept
return prev_volume_version != sw_volume_state_get_hash() ||
prev_output_version != audio_output_state_get_version() ||
prev_playlist_version != playlist_state_get_hash(partition.playlist,
- partition.pc);
+ partition.pc)
+#ifdef ENABLE_DATABASE
+ || prev_storage_version != storage_state_get_hash(partition.instance)
+#endif
+ ;
}
inline void
@@ -72,6 +80,11 @@ StateFile::Write(BufferedOutputStream &os)
{
save_sw_volume_state(os);
audio_output_state_save(os, partition.outputs);
+
+#ifdef ENABLE_DATABASE
+ storage_state_save(os, partition.instance);
+#endif
+
playlist_state_save(os, partition.playlist, partition.pc);
}
@@ -123,6 +136,10 @@ try {
playlist_state_restore(line, file, song_loader,
partition.playlist,
partition.pc);
+#ifdef ENABLE_DATABASE
+ success = success || storage_state_restore(line, file, partition.instance);
+#endif
+
if (!success)
FormatError(state_file_domain,
"Unrecognized line in state file: %s",