diff options
Diffstat (limited to 'src/database.h')
-rw-r--r-- | src/database.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/database.h b/src/database.h index b6884b604..ff17e3eb0 100644 --- a/src/database.h +++ b/src/database.h @@ -20,6 +20,7 @@ #ifndef MPD_DATABASE_H #define MPD_DATABASE_H +#include <stdbool.h> #include <sys/time.h> struct directory; @@ -55,4 +56,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 |