summary refs log tree commit diff stats
path: root/src/common/cfgfiles.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-10-27 12:51:14 -0400
committerTingPing <tingping@tingping.se>2013-10-27 12:51:14 -0400
commitaadee8afbad700f67ddd81c1dcbdc014c4341284 (patch)
tree447f809f8fe61c2c31d40cfb5b141de655521e97 /src/common/cfgfiles.c
parenta1c9294b89efcec752ca4a83e57fb2bf8dbf0ef8 (diff)
Use a full path to configdir when using portable mode
This avoids the issue of plugins changing paths on us
Diffstat (limited to 'src/common/cfgfiles.c')
-rw-r--r--src/common/cfgfiles.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index b6305cc2..725b9632 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -332,7 +332,19 @@ get_xdir (void)
 
 		if (portable_mode () || !get_reg_str ("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "AppData", out, sizeof (out)))
 		{
-			xdir = g_strdup (".\\config");
+			char *path;
+			char file[MAX_PATH];
+			HMODULE hModule;
+			
+			hModule = GetModuleHandle (NULL);
+			if (GetModuleFileName (hModule, file, sizeof(file)))
+			{
+				path = g_path_get_dirname (file);
+				xdir = g_build_filename (path, "config", NULL);
+				g_free (path);
+			}
+			else
+				xdir = g_strdup (".\\config");
 		}
 		else
 		{