mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Use CSIDL_LOCAL_APPDATA on Windows
Make g_get_user_data_dir() return the CSIDL_LOCAL_APPDATA folder on Windows, and not CSIDL_PERSONAL. On Windows 7, that corresponds to the subfolders AppData\Local vs. Documents under the profile ("home") folder. This matches what Qt does, for instance, and has been widely requested. Also make g_get_user_config_dir() return this and not the (roaming) CSIDL_APPDATA folder. The reason for this change is that it would be surprising and hard to justify if g_get_user_data_dir() returned the local application data folder while g_get_user_config_dir() would return the roaming one. Nothing in the function names or the XDG specs suggests that any roaming vs. local dichotomy would be involved. Document the new semantics and the fact that these two functions now return the same directory on Windows. Note that in reality, code that really truly wants to support Windows as well as possible probably will not use these GLib functions anyway, but Win32 APIs directly to be sure what it is doing... Should hopefully satisfy complaints in bug #620710 and related bugs.
This commit is contained in:
parent
9040eac4eb
commit
9d80c36141
@ -2065,8 +2065,10 @@ g_set_application_name (const gchar *application_name)
|
|||||||
* XDG Base Directory Specification</ulink>.
|
* XDG Base Directory Specification</ulink>.
|
||||||
* In this case the directory retrieved will be XDG_DATA_HOME.
|
* In this case the directory retrieved will be XDG_DATA_HOME.
|
||||||
*
|
*
|
||||||
* On Windows is the virtual folder that represents the My Documents
|
* On Windows this is the folder to use for local (as opposed to
|
||||||
* desktop item. See documentation for CSIDL_PERSONAL.
|
* roaming) application data. See documentation for
|
||||||
|
* CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
|
||||||
|
* what g_get_user_config_dir() returns.
|
||||||
*
|
*
|
||||||
* Return value: a string owned by GLib that must not be modified
|
* Return value: a string owned by GLib that must not be modified
|
||||||
* or freed.
|
* or freed.
|
||||||
@ -2082,7 +2084,7 @@ g_get_user_data_dir (void)
|
|||||||
if (!g_user_data_dir)
|
if (!g_user_data_dir)
|
||||||
{
|
{
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
data_dir = get_special_folder (CSIDL_PERSONAL);
|
data_dir = get_special_folder (CSIDL_LOCAL_APPDATA);
|
||||||
#else
|
#else
|
||||||
data_dir = (gchar *) g_getenv ("XDG_DATA_HOME");
|
data_dir = (gchar *) g_getenv ("XDG_DATA_HOME");
|
||||||
|
|
||||||
@ -2119,7 +2121,7 @@ g_init_user_config_dir (void)
|
|||||||
if (!g_user_config_dir)
|
if (!g_user_config_dir)
|
||||||
{
|
{
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
config_dir = get_special_folder (CSIDL_APPDATA);
|
config_dir = get_special_folder (CSIDL_LOCAL_APPDATA);
|
||||||
#else
|
#else
|
||||||
config_dir = (gchar *) g_getenv ("XDG_CONFIG_HOME");
|
config_dir = (gchar *) g_getenv ("XDG_CONFIG_HOME");
|
||||||
|
|
||||||
@ -2151,10 +2153,10 @@ g_init_user_config_dir (void)
|
|||||||
* XDG Base Directory Specification</ulink>.
|
* XDG Base Directory Specification</ulink>.
|
||||||
* In this case the directory retrieved will be XDG_CONFIG_HOME.
|
* In this case the directory retrieved will be XDG_CONFIG_HOME.
|
||||||
*
|
*
|
||||||
* On Windows is the directory that serves as a common repository for
|
* On Windows this is the folder to use for local (as opposed to
|
||||||
* application-specific data. A typical path is
|
* roaming) application data. See documentation for
|
||||||
* C:\Documents and Settings\username\Application. See documentation for
|
* CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
|
||||||
* CSIDL_APPDATA.
|
* what g_get_user_data_dir() returns.
|
||||||
*
|
*
|
||||||
* Return value: a string owned by GLib that must not be modified
|
* Return value: a string owned by GLib that must not be modified
|
||||||
* or freed.
|
* or freed.
|
||||||
|
Loading…
Reference in New Issue
Block a user