diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-08-09 07:31:31 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-08-09 07:31:31 +0000 |
commit | 379ded77a4b51e04dfe2bbe3a97b7e8ca96300cd (patch) | |
tree | e452df2eee39c127b9244b52cdc80613df309391 /src/utils.c | |
parent | 416aeb194a7fdd9c8f643ec63b5ee4b6b408fdd3 (diff) |
modified directories for Windows convention.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@482 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/utils.c b/src/utils.c index ca0ec177..61d7f1c8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1724,34 +1724,20 @@ gint scan_mailto_url(const gchar *mailto, gchar **to, gchar **cc, gchar **bcc, return 0; } -/* - * We need this wrapper around g_get_home_dir(), so that - * we can fix some Windoze things here. Should be done in glibc of course - * but as long as we are not able to do our own extensions to glibc, we do - * it here. - */ const gchar *get_home_dir(void) { -#if HAVE_DOSISH_SYSTEM - static gchar *home_dir; - - if (!home_dir) { - home_dir = read_w32_registry_string(NULL, - "Software\\Sylpheed", "HomeDir" ); - if (!home_dir || !*home_dir) { - if (getenv ("HOMEDRIVE") && getenv("HOMEPATH")) { - const char *s = g_get_home_dir(); - if (s && *s) - home_dir = g_strdup (s); - } - if (!home_dir || !*home_dir) - home_dir = g_strdup ("c:\\sylpheed"); - } - debug_print("initialized home_dir to `%s'\n", home_dir); - } - return home_dir; -#else /* standard glib */ - return g_get_home_dir(); +#ifdef G_OS_WIN32 + static const gchar *home_dir = NULL; + + if (!home_dir) { + home_dir = g_get_home_dir(); + if (!home_dir) + home_dir = "C:\\Sylpheed"; + } + + return home_dir; +#else + return g_get_home_dir(); #endif } @@ -1760,8 +1746,14 @@ const gchar *get_rc_dir(void) static gchar *rc_dir = NULL; if (!rc_dir) +#ifdef G_OS_WIN32 rc_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, + "Application Data", G_DIR_SEPARATOR_S, RC_DIR, NULL); +#else + rc_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, + RC_DIR, NULL); +#endif return rc_dir; } @@ -1777,6 +1769,21 @@ const gchar *get_old_rc_dir(void) return old_rc_dir; } +const gchar *get_mail_base_dir(void) +{ +#if G_OS_WIN32 + static gchar *mail_base_dir = NULL; + + if (!mail_base_dir) + mail_base_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, + "Mailboxes", NULL); + + return mail_base_dir; +#else + return get_home_dir(); +#endif +} + const gchar *get_news_cache_dir(void) { static gchar *news_cache_dir = NULL; |