Skip to content

Commit

Permalink
Fix: determine default /var/lib/ path from compile time settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jul 1, 2019
1 parent 4b913a9 commit fd93a6d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ set(ETC_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}${SUBDIR}")
MESSAGE("ETC_PATH: ${ETC_PATH}")
set(PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}${SUBDIR}")
MESSAGE("PLUGIN_PATH: ${PLUGIN_PATH}")
set(VARLIB_PATH "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib${SUBDIRVAR}")
MESSAGE("VARLIB_PATH: ${VARLIB_PATH}")

if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
MESSAGE("++ 64 bit architecture")
Expand Down
5 changes: 1 addition & 4 deletions contrib/mympd.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ loglevel = 2
#myMPD user
user = mympd

#myMPD state directory
varlibdir = /var/lib/mympd

#Enable mixramp settings
mixramp = false

#Enable system commands in /etc/mympd/syscmds/
syscmds = false

[plugins]
coverextract = true
coverextract = false
3 changes: 2 additions & 1 deletion src/global.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
#define MYMPD_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH}
#define MYMPD_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"

//Webserver document root
//default paths
#define DOC_ROOT "${ASSETS_PATH}"
#define ETC_PATH "${ETC_PATH}"
#define PLUGIN_PATH "${PLUGIN_PATH}"
#define VARLIB_PATH "${VARLIB_PATH}"

//Max size of mpd_client response buffer
#define MAX_ELEMENTS_PER_PAGE 200
Expand Down
9 changes: 4 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ int main(int argc, char **argv) {
config->ssl_cert = strdup("/var/lib/mympd/ssl/server.pem");
config->ssl_key = strdup("/var/lib/mympd/ssl/server.key");
config->user = strdup("mympd");
config->varlibdir = strdup("/var/lib/mympd");
config->varlibdir = strdup(VARLIB_PATH);
config->stickers = true;
config->mixramp = true;
config->mixramp = false;
config->taglist = strdup("Artist,Album,AlbumArtist,Title,Track,Genre,Date,Composer,Performer");
config->searchtaglist = strdup("Artist,Album,AlbumArtist,Title,Genre,Composer,Performer");
config->browsetaglist = strdup("Artist,Album,AlbumArtist,Genre,Composer,Performer");
Expand Down Expand Up @@ -437,8 +437,7 @@ int main(int argc, char **argv) {
else {
printf("myMPD %s\n"
"Copyright (C) 2018-2019 Juergen Mang <[email protected]>\n"
"https://github.com/jcorporation/myMPD\n"
"Built " __DATE__ " "__TIME__"\n\n"
"https://github.com/jcorporation/myMPD\n\n"
"Usage: %s [/path/to/mympd.conf]\n",
MYMPD_VERSION,
argv[0]
Expand All @@ -455,7 +454,7 @@ int main(int argc, char **argv) {
if (access(configfile, F_OK ) != -1) {
LOG_INFO("Parsing config file: %s", configfile);
if (ini_parse(configfile, mympd_inihandler, config) < 0) {
LOG_ERROR("Can't load config file \"%s\"", configfile);
LOG_ERROR("Can't load config file %s", configfile);
goto cleanup;
}
}
Expand Down

0 comments on commit fd93a6d

Please sign in to comment.