+2004-08-25 Tor Lillqvist <tml@iki.fi>
+
+ Win32 equivalences of the XDG folders
+
+ * glib/gutils.c (get_special_folder): New function, calls
+ SHGetSpecialFolderLocation() to get path to places like the My
+ Documents folder.
+ (g_get_any_init): Use CSIDL_PROFILE as HOME if not
+ overridden by env vars.
+ (g_get_user_data_dir): Use CSIDL_PERSONAL.
+ (g_get_user_config_dir): Use CSIDL_APPDATA.
+ (g_get_user_cache_dir): Use CSIDL_INTERNET_CACHE. Debatable...
+ (g_get_system_data_dirs): Use CSIDL_COMMON_APPDATA and
+ CSIDL_COMMON_DOCUMENTS.
+ (g_get_system_config_dirs): Use CSIDL_COMMON_APPDATA.
+
+ * configure.in: Add -lole32 to G_LIBS_EXTRA for mingw.
+
+ * glib/glib.def: Add the new functions.
+
Mon Aug 23 16:16:35 2004 Manish Singh <yosh@gimp.org>
* glib/goption.c (g_option_group_add_entries): remove unused
+2004-08-25 Tor Lillqvist <tml@iki.fi>
+
+ Win32 equivalences of the XDG folders
+
+ * glib/gutils.c (get_special_folder): New function, calls
+ SHGetSpecialFolderLocation() to get path to places like the My
+ Documents folder.
+ (g_get_any_init): Use CSIDL_PROFILE as HOME if not
+ overridden by env vars.
+ (g_get_user_data_dir): Use CSIDL_PERSONAL.
+ (g_get_user_config_dir): Use CSIDL_APPDATA.
+ (g_get_user_cache_dir): Use CSIDL_INTERNET_CACHE. Debatable...
+ (g_get_system_data_dirs): Use CSIDL_COMMON_APPDATA and
+ CSIDL_COMMON_DOCUMENTS.
+ (g_get_system_config_dirs): Use CSIDL_COMMON_APPDATA.
+
+ * configure.in: Add -lole32 to G_LIBS_EXTRA for mingw.
+
+ * glib/glib.def: Add the new functions.
+
Mon Aug 23 16:16:35 2004 Manish Singh <yosh@gimp.org>
* glib/goption.c (g_option_group_add_entries): remove unused
+2004-08-25 Tor Lillqvist <tml@iki.fi>
+
+ Win32 equivalences of the XDG folders
+
+ * glib/gutils.c (get_special_folder): New function, calls
+ SHGetSpecialFolderLocation() to get path to places like the My
+ Documents folder.
+ (g_get_any_init): Use CSIDL_PROFILE as HOME if not
+ overridden by env vars.
+ (g_get_user_data_dir): Use CSIDL_PERSONAL.
+ (g_get_user_config_dir): Use CSIDL_APPDATA.
+ (g_get_user_cache_dir): Use CSIDL_INTERNET_CACHE. Debatable...
+ (g_get_system_data_dirs): Use CSIDL_COMMON_APPDATA and
+ CSIDL_COMMON_DOCUMENTS.
+ (g_get_system_config_dirs): Use CSIDL_COMMON_APPDATA.
+
+ * configure.in: Add -lole32 to G_LIBS_EXTRA for mingw.
+
+ * glib/glib.def: Add the new functions.
+
Mon Aug 23 16:16:35 2004 Manish Singh <yosh@gimp.org>
* glib/goption.c (g_option_group_add_entries): remove unused
+2004-08-25 Tor Lillqvist <tml@iki.fi>
+
+ Win32 equivalences of the XDG folders
+
+ * glib/gutils.c (get_special_folder): New function, calls
+ SHGetSpecialFolderLocation() to get path to places like the My
+ Documents folder.
+ (g_get_any_init): Use CSIDL_PROFILE as HOME if not
+ overridden by env vars.
+ (g_get_user_data_dir): Use CSIDL_PERSONAL.
+ (g_get_user_config_dir): Use CSIDL_APPDATA.
+ (g_get_user_cache_dir): Use CSIDL_INTERNET_CACHE. Debatable...
+ (g_get_system_data_dirs): Use CSIDL_COMMON_APPDATA and
+ CSIDL_COMMON_DOCUMENTS.
+ (g_get_system_config_dirs): Use CSIDL_COMMON_APPDATA.
+
+ * configure.in: Add -lole32 to G_LIBS_EXTRA for mingw.
+
+ * glib/glib.def: Add the new functions.
+
Mon Aug 23 16:16:35 2004 Manish Singh <yosh@gimp.org>
* glib/goption.c (g_option_group_add_entries): remove unused
+2004-08-25 Tor Lillqvist <tml@iki.fi>
+
+ Win32 equivalences of the XDG folders
+
+ * glib/gutils.c (get_special_folder): New function, calls
+ SHGetSpecialFolderLocation() to get path to places like the My
+ Documents folder.
+ (g_get_any_init): Use CSIDL_PROFILE as HOME if not
+ overridden by env vars.
+ (g_get_user_data_dir): Use CSIDL_PERSONAL.
+ (g_get_user_config_dir): Use CSIDL_APPDATA.
+ (g_get_user_cache_dir): Use CSIDL_INTERNET_CACHE. Debatable...
+ (g_get_system_data_dirs): Use CSIDL_COMMON_APPDATA and
+ CSIDL_COMMON_DOCUMENTS.
+ (g_get_system_config_dirs): Use CSIDL_COMMON_APPDATA.
+
+ * configure.in: Add -lole32 to G_LIBS_EXTRA for mingw.
+
+ * glib/glib.def: Add the new functions.
+
Mon Aug 23 16:16:35 2004 Manish Singh <yosh@gimp.org>
* glib/goption.c (g_option_group_add_entries): remove unused
G_LIBS_EXTRA="-luser32 -lkernel32"
;;
*-*-mingw*)
- G_LIBS_EXTRA="-lwsock32"
+ G_LIBS_EXTRA="-lwsock32 -lole32"
;;
*)
G_LIBS_EXTRA=""
g_get_home_dir
g_get_prgname
g_get_real_name
+ g_get_system_config_dirs
+ g_get_system_data_dirs
g_get_tmp_dir
+ g_get_user_cache_dir
+ g_get_user_config_dir
+ g_get_user_data_dir
g_get_user_name
g_getenv
g_hash_table_destroy
#ifdef G_OS_WIN32
# include <direct.h>
+# include <shlobj.h>
#endif
#ifdef HAVE_CODESET
static gchar *g_user_config_dir = NULL;
static gchar **g_system_config_dirs = NULL;
+#ifdef G_OS_WIN32
+
+static gchar *
+get_special_folder (int csidl)
+{
+ union {
+ char c[MAX_PATH+1];
+ wchar_t wc[MAX_PATH+1];
+ } path;
+ HRESULT hr;
+ LPITEMIDLIST pidl = NULL;
+ BOOL b;
+ gchar *retval = NULL;
+
+ hr = SHGetSpecialFolderLocation (NULL, csidl, &pidl);
+ if (hr == S_OK)
+ {
+ if (G_WIN32_HAVE_WIDECHAR_API ())
+ {
+ b = SHGetPathFromIDListW (pidl, path.wc);
+ if (b)
+ retval = g_utf16_to_utf8 (path.wc, -1, NULL, NULL, NULL);
+ }
+ else
+ {
+ b = SHGetPathFromIDListA (pidl, path.c);
+ if (b)
+ retval = g_locale_to_utf8 (path.c, -1, NULL, NULL, NULL);
+ }
+ CoTaskMemFree (pidl);
+ }
+ if (retval == NULL)
+ return "C:\\";
+ else
+ return retval;
+}
+
+#endif
+
/* HOLDS: g_utils_global_lock */
static void
g_get_any_init (void)
}
if (!g_home_dir)
+ g_home_dir = get_special_folder (CSIDL_PROFILE);
+
+ if (!g_home_dir)
{
/* At least at some time, HOMEDRIVE and HOMEPATH were used
* to point to the home directory, I think. But on Windows
if (!g_user_data_dir)
{
+#ifdef G_OS_WIN32
+ data_dir = get_special_folder (CSIDL_PERSONAL);
+#else
data_dir = (gchar *) g_getenv ("XDG_DATA_HOME");
if (data_dir && data_dir[0])
data_dir = g_build_filename (g_home_dir, ".local",
"share", NULL);
}
-
+#endif
g_user_data_dir = data_dir;
}
else
if (!g_user_config_dir)
{
- config_dir = (gchar *) g_getenv ("XDG_CONFIG_HOME");
-
- if (config_dir && config_dir[0])
- config_dir = g_strdup (config_dir);
- else
- {
- if (!g_tmp_dir)
- g_get_any_init ();
-
- config_dir = g_build_filename (g_home_dir, ".config", NULL);
- }
-
- g_user_config_dir = config_dir;
+#ifdef G_OS_WIN32
+ config_dir = get_special_folder (CSIDL_APPDATA);
+#else
+ config_dir = (gchar *) g_getenv ("XDG_CONFIG_HOME");
+
+ if (config_dir && config_dir[0])
+ config_dir = g_strdup (config_dir);
+ else
+ {
+ if (!g_tmp_dir)
+ g_get_any_init ();
+
+ config_dir = g_build_filename (g_home_dir, ".config", NULL);
+ }
+#endif
+ g_user_config_dir = config_dir;
}
else
config_dir = g_user_config_dir;
if (!g_user_cache_dir)
{
+#ifdef G_OS_WIN32
+ cache_dir = get_special_folder (CSIDL_INTERNET_CACHE); /* XXX correct? */
+#else
cache_dir = (gchar *) g_getenv ("XDG_CACHE_HOME");
if (cache_dir && cache_dir[0])
cache_dir = g_build_filename (g_home_dir, ".cache", NULL);
}
+#endif
g_user_cache_dir = cache_dir;
}
else
if (!g_system_data_dirs)
{
+#ifdef G_OS_WIN32
+ data_dirs = g_strconcat (get_special_folder (CSIDL_COMMON_APPDATA),
+ G_SEARCHPATH_SEPARATOR_S,
+ get_special_folder (CSIDL_COMMON_DOCUMENTS),
+ NULL);
+#else
data_dirs = (gchar *) g_getenv ("XDG_DATA_DIRS");
if (!data_dirs || !data_dirs[0])
data_dirs = "/usr/local/share/:/usr/share/";
-
- data_dir_vector = g_strsplit (data_dirs, ":", 0);
+#endif
+ data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
g_system_data_dirs = data_dir_vector;
}
if (!g_system_config_dirs)
{
+#ifdef G_OS_WIN32
+ conf_dirs = get_special_folder (CSIDL_COMMON_APPDATA);
+#else
conf_dirs = (gchar *) g_getenv ("XDG_CONFIG_DIRS");
if (!conf_dirs || !conf_dirs[0])
conf_dirs = "/etc/xdg";
-
- conf_dir_vector = g_strsplit (conf_dirs, ":", 0);
+#endif
+ conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
}
else
conf_dir_vector = g_system_config_dirs;