Skip to content

Commit 9c00b7f

Browse files
committed
Android: properly setup our paths <HOME>, <DATA> and <BUNDLE>.
Since on Android our flx files are always bundled in the APK we can safely assume that it exists.
1 parent 1d6c8a0 commit 9c00b7f

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

exult.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ using namespace Pentagram;
123123
# include "ios_utils.h"
124124
#elif defined(ANDROID)
125125
# include "TouchUI_Android.h"
126-
127-
# include <SDL_system.h>
128126
#endif
129127

130128
using std::atexit;
@@ -296,12 +294,6 @@ int main(int argc, char* argv[]) {
296294
return std::make_unique<SdlRwopsOstream>(s, mode);
297295
});
298296

299-
#ifdef ANDROID
300-
// Doing this ifdef here rather than in utils.cc so that it doesn't have to
301-
// take a dependency on SDL.
302-
U7set_home(SDL_AndroidGetInternalStoragePath());
303-
#endif
304-
305297
// Declare everything from the commandline that we're interested in.
306298
parameters.declare("-h", &needhelp, true);
307299
parameters.declare("--help", &needhelp, true);

files/utils.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,11 +751,16 @@ string Get_home() {
751751
}
752752
}
753753
# endif // PORTABLE_WIN32_EXULT
754-
#else
754+
#else
755+
# ifdef ANDROID
756+
const char *home = SDL_AndroidGetInternalStoragePath();
757+
home_directory = home;
758+
# else
755759
const char* home = nullptr;
756760
if ((home = getenv("HOME")) != nullptr) {
757761
home_directory = home;
758762
}
763+
# endif
759764
#endif
760765
return home_directory;
761766
}
@@ -824,6 +829,16 @@ void setup_data_dir(const std::string& data_path, const char* runpath) {
824829
return;
825830
}
826831
#endif
832+
#ifdef ANDROID
833+
// We always have the APK with the bundled flx files
834+
add_system_path("<BUNDLE>", "data");
835+
// for optional data use the InternalStoragePath data folder
836+
const char *androidpath = SDL_AndroidGetInternalStoragePath();
837+
string path(androidpath);
838+
path += "/data";
839+
add_system_path("<DATA>", path);
840+
return;
841+
#endif
827842

828843
// First, try the cfg value:
829844
add_system_path("<DATA>", data_path);

0 commit comments

Comments
 (0)