1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix base path initializing on Android

This commit is contained in:
Mathieu Schroeter 2018-06-09 16:15:41 +02:00
parent dcadfe1c38
commit 5c8bd3ac27

View File

@ -109,8 +109,9 @@ std::string
GetShareDir () GetShareDir ()
{ {
static std::string basePath; static std::string basePath;
static bool inited = false;
if (!basePath.size ()) if (!inited)
{ {
auto sdlBasePath = SDL_GetBasePath (); auto sdlBasePath = SDL_GetBasePath ();
if (!sdlBasePath) if (!sdlBasePath)
@ -123,6 +124,7 @@ GetShareDir ()
std::replace (basePath.begin (), basePath.end (), '\\', '/'); std::replace (basePath.begin (), basePath.end (), '\\', '/');
basePath = basePath.substr (0, basePath.find_last_of ("//") + 1); basePath = basePath.substr (0, basePath.find_last_of ("//") + 1);
SDL_free (sdlBasePath); SDL_free (sdlBasePath);
inited = true;
} }
return basePath + "share/"; return basePath + "share/";