store config in /var/lib/snapcast/

This commit is contained in:
badaix 2016-02-21 13:18:40 +01:00
parent 968bfdf498
commit 3a02bc3dde
3 changed files with 24 additions and 9 deletions

View file

@ -39,10 +39,10 @@ daemonize, optional process priority [-20..19]
.TP .TP
\fB--latency\fR \fB--latency\fR
latency of the soundcard latency of the soundcard
.\".SH FILES .SH FILES
.\".TP .TP
.\"\fC/dev/cf0\fR \fI/etc/default/snapclient\fR
The remote coffee machine device the daemon default configuration file
.SH "COPYRIGHT" .SH "COPYRIGHT"
Copyright (C) 2014-2016 Johannes Pohl (johannes.pohl@badaix.de). Copyright (C) 2014-2016 Johannes Pohl (johannes.pohl@badaix.de).
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.

View file

@ -20,6 +20,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fstream> #include <fstream>
#include "common/snapException.h"
#include "common/compat.h"
#include "common/log.h" #include "common/log.h"
using namespace std; using namespace std;
@ -27,10 +29,17 @@ using namespace std;
Config::Config() Config::Config()
{ {
string dir = getenv("HOME") + string("/.config/Snapcast/"); string dir;
mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); if (getenv("HOME") == NULL)
filename_ = dir + "settings.json"; dir = "/var/lib/snapcast/";
cerr << filename_ << "\n"; else
dir = getenv("HOME") + string("/.config/snapcast/");
int status = mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if ((status != 0) && (errno != EEXIST))
throw SnapException("failed to create settings directory: \"" + dir + "\": " + cpt::to_string(errno));
filename_ = dir + "server.json";
logO << "Settings file: " << filename_ << "\n";
try try
{ {

View file

@ -46,8 +46,14 @@ buffer [ms] (default = 1000)
daemonize, optional process priority [-20..19] daemonize, optional process priority [-20..19]
.SH FILES .SH FILES
.TP .TP
\fC/tmp/snapfifo\fR \fI/tmp/snapfifo\fR
PCM input fifo file PCM input fifo file
.TP
\fI/etc/default/snapserver\fR
the daemon default configuration file
.TP
\fI~/.config/snapcast/server.json\fR or (if $HOME is not set) \fI/var/lib/snapcast/server.json\fR
persistent server data file
.SH "COPYRIGHT" .SH "COPYRIGHT"
Copyright (C) 2014-2016 Johannes Pohl (johannes.pohl@badaix.de). Copyright (C) 2014-2016 Johannes Pohl (johannes.pohl@badaix.de).
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.