From 5c8bd3ac2737f2d352fa5bfddda5ba22183e6429 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Sat, 9 Jun 2018 16:15:41 +0200 Subject: [PATCH] Fix base path initializing on Android --- src/misc.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/misc.cxx b/src/misc.cxx index 69dcdf5..b9a8aa2 100644 --- a/src/misc.cxx +++ b/src/misc.cxx @@ -109,8 +109,9 @@ std::string GetShareDir () { static std::string basePath; + static bool inited = false; - if (!basePath.size ()) + if (!inited) { auto sdlBasePath = SDL_GetBasePath (); if (!sdlBasePath) @@ -123,6 +124,7 @@ GetShareDir () std::replace (basePath.begin (), basePath.end (), '\\', '/'); basePath = basePath.substr (0, basePath.find_last_of ("//") + 1); SDL_free (sdlBasePath); + inited = true; } return basePath + "share/";