aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-20 06:15:41 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-20 06:15:41 +0000
commit40168aab1e33815859958ba3541cf953a20e46b6 (patch)
treedd7e7ccd5941505479e172637bdf6ee0d336bfbb /libsylph
parent4b921d38b48195db59f0224e994f8372adb5873f (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')
-rw-r--r--libsylph/utils.c34
-rw-r--r--libsylph/utils.h4
2 files changed, 36 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;
diff --git a/libsylph/utils.h b/libsylph/utils.h
index f628551f..ab898dd0 100644
--- a/libsylph/utils.h
+++ b/libsylph/utils.h
@@ -350,7 +350,11 @@ gint scan_mailto_url (const gchar *mailto,
gchar **subject,
gchar **body);
+void set_startup_dir (void);
+void set_rc_dir (const gchar *dir);
+
/* return static strings */
+const gchar *get_startup_dir (void);
const gchar *get_home_dir (void);
const gchar *get_rc_dir (void);
const gchar *get_old_rc_dir (void);