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

Fix game reloading by using the absolute bin directory

This commit is contained in:
Mathieu Schroeter 2018-08-23 22:40:58 +02:00
parent f023eb6723
commit d7befe3d7e
4 changed files with 27 additions and 4 deletions

View File

@ -1119,7 +1119,13 @@ main (int argc, char * argv[])
}
_argv.push_back (nullptr);
std::string argv0 = getenv ("APPIMAGE") ? getenv ("APPIMAGE") : argv[0];
std::string argv0;
if (getenv ("APPIMAGE"))
argv0 = getenv ("APPIMAGE");
else
argv0 = GetBinDir () + basename (argv[0]);
execv (argv0.c_str (), const_cast<char **> (&_argv[0]));
}

View File

@ -22,3 +22,4 @@
#define PB_VERSION_MINOR @PB_VERSION_MINOR@
#define PB_VERSION_PATCH @PB_VERSION_PATCH@
#define PB_VERSION_EXTRA "@PB_VERSION_EXTRA@"
#define PB_BINDIR "@CMAKE_INSTALL_BINDIR@"

View File

@ -34,6 +34,7 @@
#include <SDL_mouse.h>
#include "blupi.h"
#include "config.h"
#include "def.h"
#include "misc.h"
@ -105,8 +106,8 @@ GetBaseDir ()
return GetShareDir () + "planetblupi/";
}
std::string
GetShareDir ()
static std::string
GetDataDir ()
{
static std::string basePath;
@ -123,7 +124,21 @@ GetShareDir ()
SDL_free (sdlBasePath);
}
return basePath + "share/";
return basePath;
}
std::string
GetShareDir ()
{
return GetDataDir () + "share/";
}
std::string
GetBinDir ()
{
std::string abs;
std::string bin = GetDataDir () + PB_BINDIR + "/";
return bin;
}
// Ajoute le chemin permettant de lire un fichier

View File

@ -35,6 +35,7 @@ extern Sint32 Random (Sint32 min, Sint32 max);
std::string GetBaseDir ();
std::string GetShareDir ();
std::string GetBinDir ();
std::string GetLocale ();
extern void AddUserPath (std::string & pFilename);