Extract pid file name to global defs

This commit is contained in:
Shawn Chain 2018-11-09 18:29:09 +08:00
parent 17af032279
commit 95b7e51c30
2 changed files with 20 additions and 14 deletions

View file

@ -2,22 +2,28 @@
#define __GLOBAL_DEFS__
#if defined(__APPLE__)
#define DATA_DIR "/opt/mmdvm/conf/dstar"
#define LOG_DIR "/opt/mmdvm/logs"
#define CONF_DIR "/opt/mmdvm/conf"
#define CONF_FILE "ircDDBGateway.ini"
#define DATA_DIR "/opt/mmdvm/conf/dstar"
#define LOG_DIR "/opt/mmdvm/logs"
#define CONF_DIR "/opt/mmdvm/conf"
#define CONF_FILE "ircDDBGateway.ini"
#define PID_FILE "/tmp/ircDDBGateway.pid"
#define PID_FILE_T "/tmp/ircDDBGateway_%s.pid"
#elif defined(OPENWRT) && OPENWRT == 1
#define DATA_DIR "/etc/mmdvm/dstar"
#define LOG_DIR "/var/log/mmdvm"
#define CONF_DIR "/etc"
#define CONF_FILE "ircDDBGateway.ini"
#define DATA_DIR "/etc/mmdvm/dstar"
#define LOG_DIR "/var/log/mmdvm"
#define CONF_DIR "/etc"
#define CONF_FILE "ircDDBGateway.ini"
#define PID_FILE "/tmp/ircDDBGateway.pid"
#define PID_FILE_T "/tmp/ircDDBGateway_%s.pid"
#else
#define DATA_DIR "/usr/share/ircddbgateway"
#define LOG_DIR "/tmp"
#define CONF_DIR "/etc"
#define CONF_FILE "ircddbgateway"
#define DATA_DIR "/usr/share/ircddbgateway"
#define LOG_DIR "/tmp"
#define CONF_DIR "/etc"
#define CONF_FILE "ircddbgateway"
#define PID_FILE "/tmp/ircddbgateway.pid"
#define PID_FILE_T "/tmp/ircddbgateway_%s.pid"
#endif

View file

@ -124,9 +124,9 @@ int main(int argc, char** argv)
wxString pidFileName;
if (!name.IsEmpty())
pidFileName.Printf(wxT("/var/run/opendv/ircddbgateway_%s.pid"), name.c_str());
pidFileName.Printf(wxT(PID_FILE_T), name.c_str());
else
pidFileName = wxT("/var/run/opendv/ircddbgateway.pid");
pidFileName = wxT(PID_FILE);
pidFileName.Replace(wxT(" "), wxT("_"));
char fileName[128U];