diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-20 06:15:41 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-20 06:15:41 +0000 |
commit | 40168aab1e33815859958ba3541cf953a20e46b6 (patch) | |
tree | dd7e7ccd5941505479e172637bdf6ee0d336bfbb /libsylph/utils.c | |
parent | 4b921d38b48195db59f0224e994f8372adb5873f (diff) |
added '--configdir' option which specifies config directory.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@667 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r-- | libsylph/utils.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c index 95e1e7c0..84b3bf2f 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -1645,6 +1645,38 @@ gint scan_mailto_url(const gchar *mailto, gchar **to, gchar **cc, gchar **bcc, return 0; } +static gchar *startup_dir = NULL; +static gchar *rc_dir = NULL; + +void set_startup_dir(void) +{ + if (!startup_dir) + startup_dir = g_get_current_dir(); +} + +void set_rc_dir(const gchar *dir) +{ + if (rc_dir) + g_free(rc_dir); + + if (dir) { + if (g_path_is_absolute(dir)) + rc_dir = g_strdup(dir); + else + rc_dir = g_strconcat(get_startup_dir(), + G_DIR_SEPARATOR_S, dir, NULL); + } else + rc_dir = NULL; +} + +const gchar *get_startup_dir(void) +{ + if (!startup_dir) + set_startup_dir(); + + return startup_dir; +} + const gchar *get_home_dir(void) { #ifdef G_OS_WIN32 @@ -1664,8 +1696,6 @@ const gchar *get_home_dir(void) const gchar *get_rc_dir(void) { - static gchar *rc_dir = NULL; - if (!rc_dir) { #ifdef G_OS_WIN32 const gchar *appdata; |