comparison mcabber/src/histolog.c @ 1167:9726c78a91f3

Allow '~' (HOME directory) in config options
author Mikael Berthe <mikael@lilotux.net>
date Sun, 18 Feb 2007 11:03:49 +0100
parents 3b9bbf6c4c93
children e802ec0c02d2
comparison
equal deleted inserted replaced
1166:c4da23bf8958 1167:9726c78a91f3
307 UseFileLogging = enable; 307 UseFileLogging = enable;
308 FileLoadLogs = loadfiles; 308 FileLoadLogs = loadfiles;
309 309
310 if (enable || loadfiles) { 310 if (enable || loadfiles) {
311 if (root_dir) { 311 if (root_dir) {
312 char *xp_root_dir;
312 int l = strlen(root_dir); 313 int l = strlen(root_dir);
313 if (l < 1) { 314 if (l < 1) {
314 scr_LogPrint(LPRINT_LOGNORM, "Error: logging dir name too short"); 315 scr_LogPrint(LPRINT_LOGNORM, "Error: logging dir name too short");
315 UseFileLogging = FileLoadLogs = FALSE; 316 UseFileLogging = FileLoadLogs = FALSE;
316 return; 317 return;
317 } 318 }
319 xp_root_dir = expand_filename(root_dir);
318 // RootDir must be slash-terminated 320 // RootDir must be slash-terminated
319 if (root_dir[l-1] == '/') 321 if (root_dir[l-1] == '/') {
320 RootDir = g_strdup(root_dir); 322 RootDir = xp_root_dir;
321 else 323 } else {
322 RootDir = g_strdup_printf("%s/", root_dir); 324 RootDir = g_strdup_printf("%s/", xp_root_dir);
325 g_free(xp_root_dir);
326 }
323 } else { 327 } else {
324 char *home = getenv("HOME"); 328 char *home = getenv("HOME");
325 const char *dir = "/.mcabber/histo/"; 329 const char *dir = "/.mcabber/histo/";
326 RootDir = g_strdup_printf("%s%s", home, dir); 330 RootDir = g_strdup_printf("%s%s", home, dir);
327 } 331 }