Skip to content

Commit

Permalink
iOS document directories. Might use these on other platforms as well.
Browse files Browse the repository at this point in the history
(cherry picked from commit 0238d15)
  • Loading branch information
singalen authored and Vultraz committed Oct 28, 2018
1 parent f4f7086 commit e88d56c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/filesystem.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit e88d56c

Please sign in to comment.