mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Windows: Use a more modern API for determining the save directory.
--HG-- branch : minor
This commit is contained in:
@@ -37,6 +37,8 @@
|
|||||||
#ifdef LOVE_WINDOWS
|
#ifdef LOVE_WINDOWS
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
|
# include <initguid.h>
|
||||||
|
# include <Shlobj.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
@@ -497,8 +499,17 @@ std::string Filesystem::getAppdataDirectory()
|
|||||||
#ifdef LOVE_WINDOWS_UWP
|
#ifdef LOVE_WINDOWS_UWP
|
||||||
appdata = getUserDirectory();
|
appdata = getUserDirectory();
|
||||||
#elif defined(LOVE_WINDOWS)
|
#elif defined(LOVE_WINDOWS)
|
||||||
wchar_t *w_appdata = _wgetenv(L"APPDATA");
|
PWSTR path = nullptr;
|
||||||
appdata = to_utf8(w_appdata);
|
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &path)))
|
||||||
|
{
|
||||||
|
appdata = to_utf8(path);
|
||||||
|
CoTaskMemFree(path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wchar_t *w_appdata = _wgetenv(L"APPDATA");
|
||||||
|
appdata = to_utf8(w_appdata);
|
||||||
|
}
|
||||||
replace_char(appdata, '\\', '/');
|
replace_char(appdata, '\\', '/');
|
||||||
#elif defined(LOVE_MACOS)
|
#elif defined(LOVE_MACOS)
|
||||||
appdata = normalize(love::macos::getAppdataDirectory());
|
appdata = normalize(love::macos::getAppdataDirectory());
|
||||||
|
|||||||
Reference in New Issue
Block a user