SF.net SVN: geany: [2138] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Dec 30 20:57:39 UTC 2007
Revision: 2138
http://geany.svn.sourceforge.net/geany/?rev=2138&view=rev
Author: eht16
Date: 2007-12-30 12:57:34 -0800 (Sun, 30 Dec 2007)
Log Message:
-----------
Create Geany's configuration directory in user's appdata path instead of the default home directory (closes #1856305).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/main.c
trunk/src/win32.c
trunk/src/win32.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-12-30 15:54:00 UTC (rev 2137)
+++ trunk/ChangeLog 2007-12-30 20:57:34 UTC (rev 2138)
@@ -9,8 +9,10 @@
messages on Windows.
Fix wrong argument in win32_check_write_permission()
(reported by Jeff Pohlmeyer, thanks).
+ * src/main.c, src/win32.c, src/win32.h:
+ Create Geany's configuration directory in user's appdata path instead
+ of the default home directory (closes #1856305).
-
2007-12-28 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* plugins/filebrowser.c:
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2007-12-30 15:54:00 UTC (rev 2137)
+++ trunk/src/main.c 2007-12-30 20:57:34 UTC (rev 2138)
@@ -481,8 +481,25 @@
app->configdir = alternate_config;
}
else
- app->configdir = g_strconcat(GEANY_HOME_DIR, G_DIR_SEPARATOR_S, ".", PACKAGE, NULL);
+ {
+#ifdef G_OS_WIN32
+ gchar *appdata;
+ appdata = win32_get_appdata_folder();
+ if (appdata != NULL)
+ {
+ app->configdir = g_strconcat(appdata, G_DIR_SEPARATOR_S, "Geany", NULL);
+ g_free(appdata);
+ }
+ else
+ {
+ app->configdir = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, "Geany", NULL);
+ }
+#else
+ app->configdir = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, ".geany", NULL);
+#endif
+ }
+
#ifdef GEANY_DEBUG
if (generate_datafiles)
{
Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c 2007-12-30 15:54:00 UTC (rev 2137)
+++ trunk/src/win32.c 2007-12-30 20:57:34 UTC (rev 2138)
@@ -658,4 +658,30 @@
}
+/* Used to get special Windows folder paths like %appdata%,
+ * Code taken from Sylpheed, thanks */
+gchar *win32_get_appdata_folder()
+{
+ gchar *folder = NULL;
+ gint nfolder = CSIDL_APPDATA;
+ HRESULT hr;
+
+ if (G_WIN32_HAVE_WIDECHAR_API())
+ {
+ wchar_t path[MAX_PATH + 1];
+ hr = SHGetFolderPathW(NULL, nfolder, NULL, 0, path);
+ if (hr == S_OK)
+ folder = g_utf16_to_utf8(path, -1, NULL, NULL, NULL);
+ }
+ else
+ {
+ gchar path[MAX_PATH + 1];
+ hr = SHGetFolderPathA(NULL, nfolder, NULL, 0, path);
+ if (hr == S_OK)
+ folder = g_locale_to_utf8(path, -1, NULL, NULL, NULL);
+ }
+
+ return folder;
+}
+
#endif
Modified: trunk/src/win32.h
===================================================================
--- trunk/src/win32.h 2007-12-30 15:54:00 UTC (rev 2137)
+++ trunk/src/win32.h 2007-12-30 20:57:34 UTC (rev 2138)
@@ -57,5 +57,6 @@
void win32_init_debug_code();
+gchar *win32_get_appdata_folder();
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list