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
\fB--latency\fR
latency of the soundcard
.\".SH FILES
.\".TP
.\"\fC/dev/cf0\fR
The remote coffee machine device
.SH FILES
.TP
\fI/etc/default/snapclient\fR
the daemon default configuration file
.SH "COPYRIGHT"
Copyright (C) 2014-2016 Johannes Pohl (johannes.pohl@badaix.de).
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/stat.h>
#include <fstream>
#include "common/snapException.h"
#include "common/compat.h"
#include "common/log.h"
using namespace std;
@ -27,10 +29,17 @@ using namespace std;
Config::Config()
{
string dir = getenv("HOME") + string("/.config/Snapcast/");
mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
filename_ = dir + "settings.json";
cerr << filename_ << "\n";
string dir;
if (getenv("HOME") == NULL)
dir = "/var/lib/snapcast/";
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
{

View file

@ -46,8 +46,14 @@ buffer [ms] (default = 1000)
daemonize, optional process priority [-20..19]
.SH FILES
.TP
\fC/tmp/snapfifo\fR
\fI/tmp/snapfifo\fR
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"
Copyright (C) 2014-2016 Johannes Pohl (johannes.pohl@badaix.de).
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.