mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
After investigating more closely the actual use cases of this function, I
2005-04-08 Tor Lillqvist <tml@novell.com> * glib/gutils.c (g_get_system_data_dirs): After investigating more closely the actual use cases of this function, I understand better what it needs to do on Windows. In addition to the Windows COMMON_APPDATA and COMMON_DOCUMENTS folders, also return the "share" subfolders of GLib's installation location and the application .exe's installation location, hoping that either matches what the function's caller is looking for.
This commit is contained in:
parent
d7f079f161
commit
01f82530aa
@ -1,5 +1,13 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.c (g_get_system_data_dirs): After investigating more
|
||||
closely the actual use cases of this function, I understand better
|
||||
what it needs to do on Windows. In addition to the Windows
|
||||
COMMON_APPDATA and COMMON_DOCUMENTS folders, also return the
|
||||
"share" subfolders of GLib's installation location and the
|
||||
application .exe's installation location, hoping that either
|
||||
matches what the function's caller is looking for.
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
|
@ -1,5 +1,13 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.c (g_get_system_data_dirs): After investigating more
|
||||
closely the actual use cases of this function, I understand better
|
||||
what it needs to do on Windows. In addition to the Windows
|
||||
COMMON_APPDATA and COMMON_DOCUMENTS folders, also return the
|
||||
"share" subfolders of GLib's installation location and the
|
||||
application .exe's installation location, hoping that either
|
||||
matches what the function's caller is looking for.
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
|
@ -1,5 +1,13 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.c (g_get_system_data_dirs): After investigating more
|
||||
closely the actual use cases of this function, I understand better
|
||||
what it needs to do on Windows. In addition to the Windows
|
||||
COMMON_APPDATA and COMMON_DOCUMENTS folders, also return the
|
||||
"share" subfolders of GLib's installation location and the
|
||||
application .exe's installation location, hoping that either
|
||||
matches what the function's caller is looking for.
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
|
@ -1,5 +1,13 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.c (g_get_system_data_dirs): After investigating more
|
||||
closely the actual use cases of this function, I understand better
|
||||
what it needs to do on Windows. In addition to the Windows
|
||||
COMMON_APPDATA and COMMON_DOCUMENTS folders, also return the
|
||||
"share" subfolders of GLib's installation location and the
|
||||
application .exe's installation location, hoping that either
|
||||
matches what the function's caller is looking for.
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
|
@ -105,6 +105,8 @@ const guint glib_micro_version = GLIB_MICRO_VERSION;
|
||||
const guint glib_interface_age = GLIB_INTERFACE_AGE;
|
||||
const guint glib_binary_age = GLIB_BINARY_AGE;
|
||||
|
||||
G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
|
||||
|
||||
/**
|
||||
* glib_check_version:
|
||||
* @required_major: the required major version.
|
||||
@ -1896,7 +1898,11 @@ g_get_system_data_dirs (void)
|
||||
if (!g_system_data_dirs)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gchar *glib_top_share_dir, *exe_top_share_dir;
|
||||
|
||||
/* Documents and Settings\All Users\Application Data */
|
||||
char *appdata = get_special_folder (CSIDL_COMMON_APPDATA);
|
||||
/* Documents and Settings\All Users\Documents */
|
||||
char *docs = get_special_folder (CSIDL_COMMON_DOCUMENTS);
|
||||
|
||||
if (appdata && docs)
|
||||
@ -1913,18 +1919,48 @@ g_get_system_data_dirs (void)
|
||||
else if (docs)
|
||||
data_dirs = docs;
|
||||
else
|
||||
data_dirs = NULL;
|
||||
data_dirs = g_strdup ("");
|
||||
|
||||
if (data_dirs)
|
||||
/* Using the above subfolders of Documents and Settings perhaps
|
||||
* makes sense from a Windows perspective.
|
||||
*
|
||||
* But looking at the actual use cases of this function in GTK+
|
||||
* and GNOME software, what we really want is the "share"
|
||||
* subdirectory of the installation directory for the package
|
||||
* our caller is a part of.
|
||||
*
|
||||
* As we don't know who calls us, punt, and use the installation
|
||||
* location of GLib, and of the .exe file being run. To guard
|
||||
* against neither of those being what we really want, callers
|
||||
* of this function should have Win32-specific code to look up
|
||||
* their installation folder themselves, and handle a subfolder
|
||||
* "share" of it in the same way as the folders returned from
|
||||
* this function.
|
||||
*/
|
||||
glib_top_share_dir = g_win32_get_package_installation_subdirectory (NULL, dll_name, "share");
|
||||
|
||||
if (glib_top_share_dir)
|
||||
{
|
||||
data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||
g_free (data_dirs);
|
||||
gchar *tem = data_dirs;
|
||||
data_dirs = g_strconcat (data_dirs, G_SEARCHPATH_SEPARATOR_S,
|
||||
glib_top_share_dir, NULL);
|
||||
g_free (tem);
|
||||
g_free (glib_top_share_dir);
|
||||
}
|
||||
else
|
||||
|
||||
exe_top_share_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, "share");
|
||||
|
||||
if (exe_top_share_dir)
|
||||
{
|
||||
/* Punt, return empty list */
|
||||
data_dir_vector = g_strsplit ("", G_SEARCHPATH_SEPARATOR_S, 0);
|
||||
gchar *tem = data_dirs;
|
||||
data_dirs = g_strconcat (data_dirs, G_SEARCHPATH_SEPARATOR_S,
|
||||
exe_top_share_dir, NULL);
|
||||
g_free (tem);
|
||||
g_free (exe_top_share_dir);
|
||||
}
|
||||
|
||||
data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||
g_free (data_dirs);
|
||||
#else
|
||||
data_dirs = (gchar *) g_getenv ("XDG_DATA_DIRS");
|
||||
|
||||
@ -2396,8 +2432,6 @@ _g_utils_thread_init (void)
|
||||
|
||||
#ifdef G_PLATFORM_WIN32
|
||||
|
||||
G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
|
||||
|
||||
static const gchar *
|
||||
_glib_get_locale_dir (void)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user