Mercurial > pidgin.yaz
comparison libpurple/prefs.c @ 20999:c4802e8288c1
Look for a default prefs.xml in the CSIDL_COMMON_APPDATA directory (e.g. c:\Documents and Settings\All Users\Application Data\purple\prefs.xml) on Windows, similarly to how this is done on other platforms.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 22 Oct 2007 23:37:00 +0000 |
parents | 999b77dcb63f |
children | f2cf1d61a676 |
comparison
equal
deleted
inserted
replaced
20998:a82465913e2e | 20999:c4802e8288c1 |
---|---|
381 } | 381 } |
382 | 382 |
383 purple_debug_info("prefs", "Reading %s\n", filename); | 383 purple_debug_info("prefs", "Reading %s\n", filename); |
384 | 384 |
385 if(!g_file_get_contents(filename, &contents, &length, &error)) { | 385 if(!g_file_get_contents(filename, &contents, &length, &error)) { |
386 #ifndef _WIN32 | 386 #ifdef _WIN32 |
387 gchar *common_appdata = wpurple_get_special_folder(CSIDL_COMMON_APPDATA); | |
388 #endif | |
387 g_free(filename); | 389 g_free(filename); |
388 g_error_free(error); | 390 g_error_free(error); |
389 | 391 |
390 error = NULL; | 392 error = NULL; |
391 | 393 |
394 #ifdef _WIN32 | |
395 filename = g_build_filename(common_appdata ? common_appdata : "", "purple", "prefs.xml", NULL); | |
396 g_free(common_appdata); | |
397 #else | |
392 filename = g_build_filename(SYSCONFDIR, "purple", "prefs.xml", NULL); | 398 filename = g_build_filename(SYSCONFDIR, "purple", "prefs.xml", NULL); |
399 #endif | |
393 | 400 |
394 purple_debug_info("prefs", "Reading %s\n", filename); | 401 purple_debug_info("prefs", "Reading %s\n", filename); |
395 | 402 |
396 if (!g_file_get_contents(filename, &contents, &length, &error)) { | 403 if (!g_file_get_contents(filename, &contents, &length, &error)) { |
397 purple_debug_error("prefs", "Error reading prefs: %s\n", | 404 purple_debug_error("prefs", "Error reading prefs: %s\n", |
400 g_free(filename); | 407 g_free(filename); |
401 prefs_loaded = TRUE; | 408 prefs_loaded = TRUE; |
402 | 409 |
403 return FALSE; | 410 return FALSE; |
404 } | 411 } |
405 #else /* _WIN32 */ | |
406 purple_debug_error("prefs", "Error reading prefs: %s\n", | |
407 error->message); | |
408 g_error_free(error); | |
409 g_free(filename); | |
410 prefs_loaded = TRUE; | |
411 | |
412 return FALSE; | |
413 #endif /* _WIN32 */ | |
414 } | 412 } |
415 | 413 |
416 context = g_markup_parse_context_new(&prefs_parser, 0, NULL, NULL); | 414 context = g_markup_parse_context_new(&prefs_parser, 0, NULL, NULL); |
417 | 415 |
418 if(!g_markup_parse_context_parse(context, contents, length, NULL)) { | 416 if(!g_markup_parse_context_parse(context, contents, length, NULL)) { |