summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-07-16 16:56:52 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-07-16 16:56:52 +0000
commit40c7fa1190c8c861188f6ecda692da280e4fdc25 (patch)
tree462cbf1739b2f3a0d1cf7aeeb586244505022069
parent581fc794b43ef3b5b2a4731b326ad11f88479bba (diff)
downloadirssi-40c7fa1190c8c861188f6ecda692da280e4fdc25.zip
--home, --config parameters now expand relative paths to absolute at startup.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1635 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/core/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/core.c b/src/core/core.c
index f0a691f6..c4600993 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -129,6 +129,7 @@ void core_init_paths(int argc, char *argv[])
{ "home", 0, POPT_ARG_STRING, NULL, 0, "Irssi home dir location (~/.irssi)", "PATH" },
{ NULL, '\0', 0, NULL }
};
+ char *str;
int n, len;
for (n = 1; n < argc; n++) {
@@ -147,6 +148,20 @@ void core_init_paths(int argc, char *argv[])
}
}
+ if (irssi_dir != NULL && !g_path_is_absolute(irssi_dir)) {
+ str = irssi_dir;
+ irssi_dir = g_strdup_printf("%s/%s", g_get_current_dir(), str);
+ g_free(str);
+ }
+
+ if (irssi_config_file != NULL &&
+ !g_path_is_absolute(irssi_config_file)) {
+ str = irssi_config_file;
+ irssi_config_file =
+ g_strdup_printf("%s/%s", g_get_current_dir(), str);
+ g_free(str);
+ }
+
args_register(options);
if (irssi_dir == NULL)