1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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:
Arseniy Shestakov
2017-08-09 01:09:29 +03:00
parent cb40c093f8
commit 21074e13c3
5 changed files with 14 additions and 4 deletions

View File

@@ -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)