# HG changeset patch # User Matti Hamalainen # Date 1352722706 -7200 # Node ID dd7b58eca06d13a9460cb4cd6f9138e8d4989216 # Parent 28688eb812de5aa9c821268ec270fee397b34f0a Use the helper functions for creating log file directory automatically. diff -r 28688eb812de -r dd7b58eca06d main.c --- a/main.c Mon Nov 12 14:18:09 2012 +0200 +++ b/main.c Mon Nov 12 14:18:26 2012 +0200 @@ -1807,6 +1807,33 @@ if (!optDaemon && !nnwin_init(SET_DELAY)) goto err_exit; + { + BOOL isDir, isWritable, isReadable; + if (nn_stat_path(optLogPath, &isDir, &isWritable, &isReadable)) + { + if (!isDir) + { + errorMsg("The log file path '%s' is not a directory.\n", + optLogPath); + goto err_exit; + } + else + if (!isWritable) + { + errorMsg("The log file path '%s' is not writable.\n", + optLogPath); + goto err_exit; + } + } + else + if (!nn_mkdir_rec(optLogPath)) + { + errorMsg("Could not create log file directory '%s'.\n", + optLogPath); + goto err_exit; + } + } + if (cursesInit) { printMsg(NULL, "%s v%s - %s\n", th_prog_name, th_prog_version, th_prog_desc);