aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-08 07:36:40 +0100
committerMax Kellermann <max@duempel.org>2009-01-08 07:36:40 +0100
commit628866a065535c43a1a0b45fd66ec5e186cb33ea (patch)
treed9c75f0a7ef3031ae41e1747f391a821e8f4ffe7 /src/database.h
parentbb08679a702f0093077d49f76d5e597f92384fb1 (diff)
downloadmpd-628866a065535c43a1a0b45fd66ec5e186cb33ea.tar.gz
mpd-628866a065535c43a1a0b45fd66ec5e186cb33ea.tar.xz
mpd-628866a065535c43a1a0b45fd66ec5e186cb33ea.zip
update: save the database even if it is empty
Save an empty database, even if the music directory is empty.
Diffstat (limited to 'src/database.h')
-rw-r--r--src/database.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/database.h b/src/database.h
index fdeab420a..f0f225108 100644
--- a/src/database.h
+++ b/src/database.h
@@ -69,4 +69,15 @@ db_load(void);
time_t
db_get_mtime(void);
+/**
+ * Returns true if there is a valid database file on the disk.
+ */
+static inline bool
+db_exists(void)
+{
+ /* mtime is set only if the database file was loaded or saved
+ successfully */
+ return db_get_mtime() > 0;
+}
+
#endif