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:
parent
f023eb6723
commit
d7befe3d7e
@ -1119,7 +1119,13 @@ main (int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
_argv.push_back (nullptr);
|
_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]));
|
execv (argv0.c_str (), const_cast<char **> (&_argv[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,3 +22,4 @@
|
|||||||
#define PB_VERSION_MINOR @PB_VERSION_MINOR@
|
#define PB_VERSION_MINOR @PB_VERSION_MINOR@
|
||||||
#define PB_VERSION_PATCH @PB_VERSION_PATCH@
|
#define PB_VERSION_PATCH @PB_VERSION_PATCH@
|
||||||
#define PB_VERSION_EXTRA "@PB_VERSION_EXTRA@"
|
#define PB_VERSION_EXTRA "@PB_VERSION_EXTRA@"
|
||||||
|
#define PB_BINDIR "@CMAKE_INSTALL_BINDIR@"
|
||||||
|
21
src/misc.cxx
21
src/misc.cxx
@ -34,6 +34,7 @@
|
|||||||
#include <SDL_mouse.h>
|
#include <SDL_mouse.h>
|
||||||
|
|
||||||
#include "blupi.h"
|
#include "blupi.h"
|
||||||
|
#include "config.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
@ -105,8 +106,8 @@ GetBaseDir ()
|
|||||||
return GetShareDir () + "planetblupi/";
|
return GetShareDir () + "planetblupi/";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
static std::string
|
||||||
GetShareDir ()
|
GetDataDir ()
|
||||||
{
|
{
|
||||||
static std::string basePath;
|
static std::string basePath;
|
||||||
|
|
||||||
@ -123,7 +124,21 @@ GetShareDir ()
|
|||||||
SDL_free (sdlBasePath);
|
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
|
// Ajoute le chemin permettant de lire un fichier
|
||||||
|
@ -35,6 +35,7 @@ extern Sint32 Random (Sint32 min, Sint32 max);
|
|||||||
|
|
||||||
std::string GetBaseDir ();
|
std::string GetBaseDir ();
|
||||||
std::string GetShareDir ();
|
std::string GetShareDir ();
|
||||||
|
std::string GetBinDir ();
|
||||||
std::string GetLocale ();
|
std::string GetLocale ();
|
||||||
extern void AddUserPath (std::string & pFilename);
|
extern void AddUserPath (std::string & pFilename);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user