comparison main.c @ 693:9ed896f7b531

Use TH_DIR_SEPARATOR_CHR instead of our own define.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 05 Jan 2020 10:47:49 +0200
parents 863542691130
children 788a58dab07a
comparison
equal deleted inserted replaced
692:863542691130 693:9ed896f7b531
21 #endif 21 #endif
22 22
23 #ifdef TH_PLAT_WINDOWS 23 #ifdef TH_PLAT_WINDOWS
24 # define SET_CONFIG_FILE "nnchat.txt" 24 # define SET_CONFIG_FILE "nnchat.txt"
25 # define SET_LOG_DIR "NNChat Log Files" 25 # define SET_LOG_DIR "NNChat Log Files"
26 # define SET_DIR_SEPARATOR '\\'
27 #else 26 #else
28 # define SET_DIR_SEPARATOR '/'
29 # define SET_LOG_DIR "nnlogs" 27 # define SET_LOG_DIR "nnlogs"
30 # if defined(USE_XDG) 28 # if defined(USE_XDG)
31 # define SET_XDG_CONFIG_DIR "nnchat" 29 # define SET_XDG_CONFIG_DIR "nnchat"
32 # define SET_CONFIG_FILE "config" 30 # define SET_CONFIG_FILE "config"
33 # else 31 # else
1843 #endif 1841 #endif
1844 1842
1845 if (!optLogEnable || optLogPath == NULL) 1843 if (!optLogEnable || optLogPath == NULL)
1846 return FALSE; 1844 return FALSE;
1847 1845
1848 plt = strrchr(optLogPath, SET_DIR_SEPARATOR); 1846 plt = strrchr(optLogPath, TH_DIR_SEPARATOR_CHR);
1849 if (plt == NULL || plt[1] != 0) 1847 if (plt == NULL || plt[1] != 0)
1850 path = th_strdup_printf("%s%c", optLogPath, SET_DIR_SEPARATOR); 1848 path = th_strdup_printf("%s%c", optLogPath, TH_DIR_SEPARATOR_CHR);
1851 else 1849 else
1852 path = th_strdup(optLogPath); 1850 path = th_strdup(optLogPath);
1853 1851
1854 if (win->id == NULL) 1852 if (win->id == NULL)
1855 { 1853 {
2052 2050
2053 if (setConfigDir != NULL) 2051 if (setConfigDir != NULL)
2054 { 2052 {
2055 th_ioctx *ctx; 2053 th_ioctx *ctx;
2056 2054
2057 setConfigFile = th_strdup_printf("%s%c%s", setConfigDir, SET_DIR_SEPARATOR, SET_CONFIG_FILE); 2055 setConfigFile = th_strdup_printf("%s%c%s", setConfigDir, TH_DIR_SEPARATOR_CHR, SET_CONFIG_FILE);
2058 if (th_io_fopen(&ctx, &th_stdio_io_ops, setConfigFile, "r") == THERR_OK) 2056 if (th_io_fopen(&ctx, &th_stdio_io_ops, setConfigFile, "r") == THERR_OK)
2059 { 2057 {
2060 th_io_set_handlers(ctx, nn_ioctx_errfunc, nn_ioctx_msgfunc); 2058 th_io_set_handlers(ctx, nn_ioctx_errfunc, nn_ioctx_msgfunc);
2061 2059
2062 THMSG(0, "Reading configuration from '%s'.\n", 2060 THMSG(0, "Reading configuration from '%s'.\n",
2077 setBrowser = "firefox"; 2075 setBrowser = "firefox";
2078 2076
2079 if (optLogPath == NULL && setHomeDir != NULL) 2077 if (optLogPath == NULL && setHomeDir != NULL)
2080 { 2078 {
2081 optLogPath = th_strdup_printf("%s%c%s%c", 2079 optLogPath = th_strdup_printf("%s%c%s%c",
2082 setHomeDir, SET_DIR_SEPARATOR, SET_LOG_DIR, SET_DIR_SEPARATOR); 2080 setHomeDir, TH_DIR_SEPARATOR_CHR, SET_LOG_DIR, TH_DIR_SEPARATOR_CHR);
2083 } 2081 }
2084 2082
2085 if (optLogEnable) 2083 if (optLogEnable)
2086 { 2084 {
2087 th_stat_data sdata; 2085 th_stat_data sdata;