mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
macOS: always change working directory for launcher and server
This make relative paths work properly when launched from DMG or from different directory.
This commit is contained in:
parent
cb40c093f8
commit
21074e13c3
@ -229,7 +229,7 @@ int wmain(int argc, wchar_t* argv[])
|
||||
#elif defined(VCMI_APPLE) || defined(VCMI_ANDROID)
|
||||
int SDL_main(int argc, char *argv[])
|
||||
#else
|
||||
int main(int argc, char** argv)
|
||||
int main(int argc, char * argv[])
|
||||
#endif
|
||||
{
|
||||
#ifdef VCMI_ANDROID
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "mainwindow_moc.h"
|
||||
#include "sdldisplayquery.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
QApplication vcmilauncher(argc, argv);
|
||||
auto displayList = getDisplays();
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
void MainWindow::load()
|
||||
{
|
||||
// Set current working dir to executable folder.
|
||||
// This is important on Mac for relative paths to work inside DMG.
|
||||
QDir::setCurrent(QApplication::applicationDirPath());
|
||||
|
||||
console = new CConsoleHandler();
|
||||
CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Launcher_log.txt", console);
|
||||
logConfig.configureDefault();
|
||||
|
@ -607,8 +607,14 @@ void handleLinuxSignal(int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
#ifdef VCMI_APPLE
|
||||
// Correct working dir executable folder (not bundle folder) so we can use executable relative paths
|
||||
std::string executablePath = argv[0];
|
||||
std::string workDir = executablePath.substr(0, executablePath.rfind('/'));
|
||||
chdir(workDir.c_str());
|
||||
#endif
|
||||
// Installs a sig sev segmentation violation handler
|
||||
// to log stacktrace
|
||||
#if defined(__GNUC__) && !defined (__MINGW32__) && !defined(VCMI_ANDROID)
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "CVcmiTestConfig.h"
|
||||
#include "../lib/filesystem/CMemoryBuffer.h"
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
CVcmiTestConfig test;
|
||||
|
Loading…
Reference in New Issue
Block a user