Skip to content

Commit

Permalink
Daemon: fix check log file in daemon mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dhamp committed Jul 11, 2013
1 parent 1810808 commit bcb2ab2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
20 changes: 14 additions & 6 deletions eiskaltdcpp-daemon/nasdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,6 @@ int main(int argc, char* argv[])
sTitle += " [debug]";
#endif

if (bDaemon) {
if (!Util::fileExists(LOG_FILE)) {
logging(false, false, false, string("ERROR: Daemon log: No such file or directory (") + LOG_FILE.c_str()+ string(")"));
}
}

Util::PathsMap override;

if (config_dir[0]) {
Expand Down Expand Up @@ -288,6 +282,20 @@ int main(int argc, char* argv[])

PATH = Util::getPath(Util::PATH_USER_CONFIG);
LOCAL_PATH = Util::getPath(Util::PATH_USER_LOCAL);

if (LOG_FILE.empty())
#ifdef _WIN32
LOG_FILE = PATH + "logs\\daemon.log";
#else
LOG_FILE = PATH + "Logs/daemon.log";
#endif

if (bDaemon) {
if (!Util::fileExists(LOG_FILE)) {
logging(false, false, false, string("ERROR: Daemon log: No such file or directory (") + LOG_FILE.c_str()+ string(")"));
}
}

#ifndef _WIN32
if (bDaemon) {
if (eidcpp_daemon(true,false) == -1)
Expand Down
12 changes: 1 addition & 11 deletions eiskaltdcpp-daemon/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,7 @@ bool DirExist(char * sPath) {
}

void Log(const string & sData) {
string tmp;
if (LOG_FILE.empty())
#ifdef _WIN32
tmp = PATH + "\\logs\\daemon.log";
#else
tmp = PATH + "/Logs/daemon.log";
#endif
else
tmp = LOG_FILE;

FILE * fw = fopen(tmp.c_str(), "a");
FILE * fw = fopen(LOG_FILE.c_str(), "a");
if(!fw) return;

time_t acc_time;
Expand Down

0 comments on commit bcb2ab2

Please sign in to comment.