1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 01:29:43 +01:00

FS: Use PHYSFS_getPrefDir on Linux/FreeBSD too

Follow-up to #19 which did the change for macOS.
It appears to work as expected on Linux too.

Tested on a distro where XDG_DATA_HOME is undefined by default,
and `PHYSFS_getPrefDir` also resolves to `~/.local/share/VVVVVV/`.
The first organization parameter is unused on Linux and macOS.
This commit is contained in:
Rémi Verschelde 2020-01-11 00:50:02 +01:00 committed by Ethan Lee
parent 2cfed68fcc
commit a9b1ff737c
2 changed files with 5 additions and 14 deletions

View file

@ -1,7 +1,10 @@
Contributors
------------
(Ordered alphabetically by last name.)
* Christoph Böhmwalder (@chrboe)
* Marvin Scholz (@ePirat)
* Elijah Stone
* Emmanuel Vadot (@evadot)
* Marvin Scholz (@ePirat)
* Rémi Verschelde (@akien-mga)

View file

@ -159,19 +159,7 @@ std::vector<std::string> FILESYSTEM_getLevelDirFileNames()
void PLATFORM_getOSDirectory(char* output)
{
#if defined(__linux__) || defined(__FreeBSD__)
const char *homeDir = getenv("XDG_DATA_HOME");
if (homeDir == NULL)
{
strcpy(output, PHYSFS_getUserDir());
strcat(output, ".local/share/VVVVVV/");
}
else
{
strcpy(output, homeDir);
strcat(output, "/VVVVVV/");
}
#elif defined(__APPLE__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
strcpy(output, PHYSFS_getPrefDir("distractionware", "VVVVVV"));
#elif defined(_WIN32)
SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, output);