Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
54b3e395
Commit
54b3e395
authored
Dec 31, 2022
by
Luca Bacci
Committed by
Jehan
Jan 24, 2023
Browse files
Use SHGetKnownFolderPath instead of the deprecated SHGetSpecialFolderLocation
parent
689201e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
libgimpbase/gimpenv.c
View file @
54b3e395
...
...
@@ -87,9 +87,6 @@
static
gchar
*
gimp_env_get_dir
(
const
gchar
*
gimp_env_name
,
const
gchar
*
compile_time_dir
,
const
gchar
*
relative_subdir
);
#ifdef G_OS_WIN32
static
gchar
*
get_special_folder
(
gint
csidl
);
#endif
const
guint
gimp_major_version
=
GIMP_MAJOR_VERSION
;
...
...
@@ -164,6 +161,33 @@ gimp_env_init (gboolean plug_in)
}
}
#ifdef G_OS_WIN32
static
char
*
get_known_folder
(
REFKNOWNFOLDERID
id
)
{
wchar_t
*
path_utf16
=
NULL
;
char
*
path
=
NULL
;
if
(
SUCCEEDED
(
SHGetKnownFolderPath
(
id
,
KF_FLAG_DEFAULT
,
NULL
,
&
path_utf16
)))
path
=
g_utf16_to_utf8
(
path_utf16
,
-
1
,
NULL
,
NULL
,
NULL
);
if
(
path_utf16
)
CoTaskMemFree
(
path_utf16
);
return
path
;
}
extern
IMAGE_DOS_HEADER
__ImageBase
;
static
HMODULE
this_module
(
void
)
{
return
(
HMODULE
)
&
__ImageBase
;
}
#endif
/**
* gimp_directory:
*
...
...
@@ -288,7 +312,7 @@ gimp_directory (void)
#elif defined G_OS_WIN32
g
char
*
conf_dir
=
get_
special
_folder
(
CSIDL_APPDATA
);
char
*
conf_dir
=
get_
known
_folder
(
&
FOLDERID_RoamingAppData
);
gimp_dir
=
g_build_filename
(
conf_dir
,
GIMPDIR
,
GIMP_USER_VERSION
,
NULL
);
...
...
@@ -308,40 +332,6 @@ gimp_directory (void)
return
gimp_dir
;
}
#ifdef G_OS_WIN32
/* Taken from glib 2.35 code. */
static
gchar
*
get_special_folder
(
int
csidl
)
{
wchar_t
path
[
MAX_PATH
+
1
];
HRESULT
hr
;
LPITEMIDLIST
pidl
=
NULL
;
BOOL
b
;
gchar
*
retval
=
NULL
;
hr
=
SHGetSpecialFolderLocation
(
NULL
,
csidl
,
&
pidl
);
if
(
hr
==
S_OK
)
{
b
=
SHGetPathFromIDListW
(
pidl
,
path
);
if
(
b
)
retval
=
g_utf16_to_utf8
(
path
,
-
1
,
NULL
,
NULL
,
NULL
);
CoTaskMemFree
(
pidl
);
}
return
retval
;
}
extern
IMAGE_DOS_HEADER
__ImageBase
;
static
HMODULE
this_module
(
void
)
{
return
(
HMODULE
)
&
__ImageBase
;
}
#endif
/**
* gimp_installation_directory:
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment