mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 10:22:52 +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:
parent
8e629fd2ab
commit
3c4ce72488
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user