1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-12 01:12:57 +00:00

Intial support for package paths (as suggested by smls).

This commit is mainly intended to ease packaging for linux.
Unless environment variable AQUARIA_DATA_PATH is set, there are two
directories which are checked by the game:
If AQUARIA_DEFAULT_DATA_DIR is defined, it will chdir there for main
operation. If it's not defined, it chdirs into the directory where
the executable is located.
Then, if AQUARIA_EXTRA_DATA_DIR is defined, it will mount this directory
and all contents into the working path, so that the files present there
will override those from the working directory when accessed by the game.

Setting the environment variable AQUARIA_DATA_PATH will disable this
behavior altogether and use *only* AQUARIA_DATA_PATH as working dir.
This commit is contained in:
fgenesis 2013-06-19 02:08:24 +02:00
commit 13eca9785f
6 changed files with 47 additions and 7 deletions

View file

@ -153,7 +153,8 @@ Vector savesz;
#define APPNAME "Aquaria"
#endif
DSQ::DSQ(std::string fileSystem) : Core(fileSystem, LR_MAX, APPNAME, PARTICLE_AMOUNT_DEFAULT, "Aquaria")
DSQ::DSQ(const std::string& fileSystem, const std::string& extraDataDir)
: Core(fileSystem, extraDataDir, LR_MAX, APPNAME, PARTICLE_AMOUNT_DEFAULT, "Aquaria")
{
// 2048
//createDirectory(getSaveDirectory());

View file

@ -1227,7 +1227,7 @@ enum NagType
class DSQ : public Core
{
public:
DSQ(std::string fileSystem);
DSQ(const std::string& fileSystem, const std::string& extraDataDir);
~DSQ();
void init();

View file

@ -83,18 +83,31 @@ static void CheckConfig(void)
extern "C" int main(int argc,char *argv[])
{
std::string dsqParam = ""; // fileSystem
std::string extraDataDir = "";
const char *envPath = 0;
#ifdef BBGE_BUILD_UNIX
const char *envPath = getenv("AQUARIA_DATA_PATH");
if (envPath != NULL)
envPath = getenv("AQUARIA_DATA_PATH");
if (envPath)
{
dsqParam = envPath;
}
#endif
#ifdef AQUARIA_DEFAULT_DATA_DIR
if(!envPath)
dsqParam = AQUARIA_DEFAULT_DATA_DIR;
#endif
#ifdef AQUARIA_EXTRA_DATA_DIR
if(!envPath)
extraDataDir = AQUARIA_EXTRA_DATA_DIR;
#endif
#endif
CheckConfig();
{
DSQ dsql(dsqParam);
DSQ dsql(dsqParam, extraDataDir);
dsql.init();
dsql.main();
dsql.shutdown();