1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 02:12:45 +01:00

Fix GameConfig::getDefaultConfigPath for OS X.

Under OS X, configuration files are usually stored in $HOME/Library/Preferences/<appname>.
This commit is contained in:
Christoph Heiss 2016-05-21 11:15:42 +02:00 committed by Marco Schmidt
parent 8e629fd2ab
commit 3c4ce72488

View File

@ -1,6 +1,7 @@
#include "GameConfig.hpp"
#include <rw/defines.hpp>
#include <cstring>
#include <cstdlib>
#include <ini.h>
@ -50,12 +51,19 @@ std::string GameConfig::getDefaultConfigPath()
if (home != nullptr) {
return std::string(home) + "/.config/" + kConfigDirectoryName;
}
// Well now we're stuck.
RW_ERROR("No default config path found.");
return ".";
#elif RW_OSX
char* home = getenv("HOME");
if (home)
return std::string(home) + "/Library/Preferences/" + kConfigDirectoryName;
#else
#error Dont know how to find default config path
#endif
// Well now we're stuck.
RW_ERROR("No default config path found.");
return ".";
}
int GameConfig::handler(void* user,