Mercurial > hg > nnchat
changeset 549:dd7b58eca06d
Use the helper functions for creating log file directory automatically.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 12 Nov 2012 14:18:26 +0200 |
parents | 28688eb812de |
children | 504a8b9297a3 |
files | main.c |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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);