changeset 545:895ede06ff11

Implement default log file directory.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 12 Nov 2012 11:28:17 +0200
parents e30fa8592a48
children 3d7ff16389cf
files main.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Sun Nov 11 19:08:21 2012 +0200
+++ b/main.c	Mon Nov 12 11:28:17 2012 +0200
@@ -17,13 +17,17 @@
 #define random rand
 #else
 #include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #endif
 
 #ifdef __WIN32
 #define SET_CONFIG_FILE    "nnchat.txt"
+#define SET_LOG_DIR        "NNChat Log Files"
 #define SET_DIR_SEPARATOR  '\\'
 #else
 #define SET_CONFIG_FILE    ".nnchat"
+#define SET_LOG_DIR        "nnlogs"
 #define SET_DIR_SEPARATOR  '/'
 #endif
 
@@ -1694,6 +1698,12 @@
     if (setBrowser == NULL)
         setBrowser = "firefox";
 
+    if (optLogPath == NULL)
+    {
+        optLogPath = th_strdup_printf("%s%c%s%c",
+            setHomeDir, SET_DIR_SEPARATOR, SET_LOG_DIR, SET_DIR_SEPARATOR);
+    }
+
     // Parse command line arguments
     argsOK = th_args_process(argc, argv, optList, optListN,
                              argHandleOpt, argHandleFile, FALSE);