iOS document directories. Might use these on other platforms as well.

This commit is contained in:
Victor Sergienko 2017-05-09 22:50:31 -07:00 committed by Jyrki Vesterinen
parent c9097f4dad
commit 912453df4c

View file

@ -52,6 +52,15 @@
#include <algorithm>
#include <set>
// Copied from boost::predef, as it's there only since 1.55.
#if defined(__APPLE__) && defined(__MACH__) && defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
#define WESNOTH_BOOST_OS_IOS (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000)
#include <SDL_filesystem.h>
#endif
static lg::log_domain log_filesystem("filesystem");
#define DBG_FS LOG_STREAM(debug, log_filesystem)
#define LOG_FS LOG_STREAM(info, log_filesystem)
@ -617,6 +626,14 @@ void set_user_data_dir(std::string newprefdir)
std::string backupprefdir = ".wesnoth" + get_version_path_suffix();
#ifdef WESNOTH_BOOST_OS_IOS
char *sdl_pref_path = SDL_GetPrefPath("wesnoth.org", "iWesnoth");
if(sdl_pref_path) {
backupprefdir = std::string(sdl_pref_path) + backupprefdir;
SDL_free(sdl_pref_path);
}
#endif
#ifdef _X11
const char* home_str = getenv("HOME");