Skip to content

Commit

Permalink
store config in /var/lib/snapcast/
Browse files Browse the repository at this point in the history
  • Loading branch information
badaix committed Feb 21, 2016
1 parent 968bfdf commit 3a02bc3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
8 changes: 4 additions & 4 deletions client/snapclient.1
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([email protected]).
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
Expand Down
17 changes: 13 additions & 4 deletions server/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,26 @@
#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;


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
{
Expand Down
8 changes: 7 additions & 1 deletion server/snapserver.1
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([email protected]).
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
Expand Down

0 comments on commit 3a02bc3

Please sign in to comment.