# HG changeset patch # User koda # Date 1356360105 -3600 # Node ID ab0b618bdf13db5a0c2c3a66ef947abd430dc5bb # Parent 50369fa5053b63901a3fd6d2fe3f97f48fbfc660 get executable directory at runtime rather than configure time diff -r 50369fa5053b -r ab0b618bdf13 QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Mon Dec 24 03:00:18 2012 +0100 +++ b/QTfrontend/CMakeLists.txt Mon Dec 24 15:41:45 2012 +0100 @@ -41,8 +41,6 @@ include_directories("/usr/local/include") endif(UNIX) -#directory containing hw executables -set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX}/${target_binary_install_dir}) #directory for resources, relative to the one above on certain platforms/configurations if(DEFINED DATA_INSTALL_DIR OR WIN32 OR APPLE) set(HEDGEWARS_DATADIR ${SHAREPATH}) diff -r 50369fa5053b -r ab0b618bdf13 QTfrontend/hwconsts.cpp.in --- a/QTfrontend/hwconsts.cpp.in Mon Dec 24 03:00:18 2012 +0100 +++ b/QTfrontend/hwconsts.cpp.in Mon Dec 24 15:41:45 2012 +0100 @@ -22,10 +22,9 @@ QString * cProtoVer = new QString("${HEDGEWARS_PROTO_VER}"); QString * cDataDir = new QString("${HEDGEWARS_DATADIR}"); -QString * cConfigDir = new QString(""); QString * cVersionString = new QString("${HEDGEWARS_VERSION}"); -QDir * bindir = new QDir("${HEDGEWARS_BINDIR}"); +QDir * bindir = new QDir(); QDir * cfgdir = new QDir(); QDir * datadir = new QDir(); diff -r 50369fa5053b -r ab0b618bdf13 QTfrontend/hwconsts.h --- a/QTfrontend/hwconsts.h Mon Dec 24 03:00:18 2012 +0100 +++ b/QTfrontend/hwconsts.h Mon Dec 24 15:41:45 2012 +0100 @@ -26,7 +26,6 @@ extern QString * cProtoVer; extern QString * cVersionString; extern QString * cDataDir; -extern QString * cConfigDir; extern QDir * bindir; extern QDir * cfgdir; diff -r 50369fa5053b -r ab0b618bdf13 QTfrontend/main.cpp --- a/QTfrontend/main.cpp Mon Dec 24 03:00:18 2012 +0100 +++ b/QTfrontend/main.cpp Mon Dec 24 15:41:45 2012 +0100 @@ -175,9 +175,14 @@ if(parsedArgs.contains("config-dir")) { QFileInfo f(parsedArgs["config-dir"]); - *cConfigDir = f.absoluteFilePath(); + cfgdir->setPath(f.absoluteFilePath()); custom_config = true; } + else + { + cfgdir->setPath(QDir::homePath()); + custom_config = false; + } app.setStyle(new QPlastiqueStyle()); @@ -190,14 +195,10 @@ qRegisterMetaType("HWTeam"); // workaround over NSIS installer which modifies the install path - bindir->cd("./"); + //bindir->cd("./"); + bindir->cd(QCoreApplication::applicationDirPath()); - if(cConfigDir->length() == 0) - cfgdir->setPath(cfgdir->homePath()); - else - cfgdir->setPath(*cConfigDir); - - if(cConfigDir->length() == 0) + if(custom_config == false) { #ifdef __APPLE__ checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars");