summaryrefslogtreecommitdiff
path: root/src/command/OtherCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-30 20:29:48 +0100
committerMax Kellermann <max@duempel.org>2014-01-30 20:39:40 +0100
commit4465e2c46bbed438377dc4a99df333bd5c058d5e (patch)
treecbc1d27aad939689f44b0ac3542a6ca1777b9dc1 /src/command/OtherCommands.cxx
parent34b309b99aa2f274308f19974c428e1c7ac5d66f (diff)
db: add compile-time option to disable database
Diffstat (limited to 'src/command/OtherCommands.cxx')
-rw-r--r--src/command/OtherCommands.cxx26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
index 3c546b9b4..76f97f389 100644
--- a/src/command/OtherCommands.cxx
+++ b/src/command/OtherCommands.cxx
@@ -19,8 +19,6 @@
#include "config.h"
#include "OtherCommands.hxx"
-#include "DatabaseCommands.hxx"
-#include "db/update/Service.hxx"
#include "CommandError.hxx"
#include "db/Uri.hxx"
#include "DetachedSong.hxx"
@@ -49,6 +47,11 @@
#include "Instance.hxx"
#include "Idle.hxx"
+#ifdef ENABLE_DATABASE
+#include "DatabaseCommands.hxx"
+#include "db/update/Service.hxx"
+#endif
+
#include <assert.h>
#include <string.h>
@@ -170,14 +173,21 @@ handle_lsinfo(Client &client, int argc, char *argv[])
return CommandResult::OK;
}
+#ifdef ENABLE_DATABASE
CommandResult result = handle_lsinfo2(client, argc, argv);
if (result != CommandResult::OK)
return result;
+#endif
if (isRootDirectory(uri)) {
Error error;
const auto &list = ListPlaylistFiles(error);
print_spl_list(client, list);
+ } else {
+#ifndef ENABLE_DATABASE
+ command_error(client, ACK_ERROR_NO_EXIST, "No database");
+ return CommandResult::ERROR;
+#endif
}
return CommandResult::OK;
@@ -186,6 +196,7 @@ handle_lsinfo(Client &client, int argc, char *argv[])
static CommandResult
handle_update(Client &client, int argc, char *argv[], bool discard)
{
+#ifdef ENABLE_DATABASE
const char *path = "";
assert(argc <= 2);
@@ -217,6 +228,15 @@ handle_update(Client &client, int argc, char *argv[], bool discard)
"already updating");
return CommandResult::ERROR;
}
+#else
+ (void)client;
+ (void)argc;
+ (void)argv;
+ (void)discard;
+
+ command_error(client, ACK_ERROR_NO_EXIST, "No database");
+ return CommandResult::ERROR;
+#endif
}
CommandResult
@@ -329,9 +349,11 @@ handle_config(Client &client,
return CommandResult::ERROR;
}
+#ifdef ENABLE_DATABASE
const char *path = mapper_get_music_directory_utf8();
if (path != nullptr)
client_printf(client, "music_directory: %s\n", path);
+#endif
return CommandResult::OK;
}