From e48d96c6382fa89b55e45ade04487f6583858f98 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 12 Sep 2013 14:59:40 +0200 Subject: [PATCH] Fix opening of configuration file Allow passing absolute filename. --- gtk/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gtk/main.c b/gtk/main.c index de8dd9fa2..9f781d2cd 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -164,7 +164,9 @@ char *linphone_gtk_get_config_file(const char *filename){ /*try accessing a local file first if exists*/ if (access(CONFIG_FILE,F_OK)==0){ snprintf(config_file,path_max,"%s",filename); - }else{ + } else if (g_path_is_absolute(filename)) { + snprintf(config_file,path_max,"%s",filename); + } else{ #ifdef WIN32 const char *appdata=getenv("APPDATA"); if (appdata){ @@ -1924,6 +1926,12 @@ int main(int argc, char *argv[]){ return -1; } if (config_file) free(config_file); + if (custom_config_file && !g_path_is_absolute(custom_config_file)) { + gchar *res = g_get_current_dir(); + res = g_strjoin(G_DIR_SEPARATOR_S, res, custom_config_file, NULL); + free(custom_config_file); + custom_config_file = res; + } config_file=linphone_gtk_get_config_file(custom_config_file); settings=gtk_settings_get_default();