diff --git a/client/CMT.cpp b/client/CMT.cpp index 3f26851cc..f0bfb1e17 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -189,7 +189,8 @@ int main(int argc, char** argv) std::string workDir = executablePath.substr(0, executablePath.rfind('/')); chdir(workDir.c_str()); - FILE* check = fopen("../Data/game_data_prepared", "r"); + // Check that game data is prepared. Otherwise run vcmibuilder helper application + FILE* check = fopen((GVCMIDirs.UserPath + "/game_data_prepared").c_str(), "r"); if (check == NULL) { system("open ./vcmibuilder.app"); return 0; diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index a7996d405..8002cdf38 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -47,14 +47,16 @@ if(WIN32) add_executable(vcmiclient WIN32 ${client_SRCS}) elseif(APPLE) # When building for OS X we need add SDLMain.m to source files - add_executable(vcmiclient MACOSX_BUNDLE ${client_SRCS} SDLMain.m ${CMAKE_CURRENT_SOURCE_DIR}/vcmi.icns) + add_executable(vcmiclient MACOSX_BUNDLE ${client_SRCS} SDLMain.m vcmi.icns Info.plist) # Because server and AI libs would be copies to bundle they need to be built before client add_dependencies(vcmiclient vcmiserver VCAI EmptyAI StupidAI BattleAI) + # Custom Info.plist + set_target_properties(vcmiclient PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) + # Copy icon file - set(MACOSX_BUNDLE_ICON_FILE vcmi.icns) - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/vcmi.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + set_source_files_properties(vcmi.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) # Copy server executable, libs and game data to bundle set(BUNDLE_PATH ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiclient.app/Contents) diff --git a/client/Info.plist b/client/Info.plist new file mode 100644 index 000000000..5ba11bb14 --- /dev/null +++ b/client/Info.plist @@ -0,0 +1,10 @@ + + + + + CFBundleIconFile + vcmi.icns + CFBundleVersion + 0.91 + + diff --git a/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m b/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m index c4694950a..2c528c2b0 100644 --- a/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m +++ b/osx/osx-vcmibuilder/vcmibuilder/AppDelegate.m @@ -9,8 +9,8 @@ tempDir = NSTemporaryDirectory(); // Output to Application Support - //NSArray* appSupportDirs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; - //outputDir = [[appSupportDirs[0] path] stringByAppendingString:@"/vcmi"]; + NSArray* appSupportDirs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; + outputDir = [[appSupportDirs[0] path] stringByAppendingString:@"/vcmi"]; } - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender @@ -241,7 +241,7 @@ // After everythin is complete we create marker file. VCMI will look for this file to exists on startup and // will run this setup otherwise - system([[NSString stringWithFormat:@"touch %@/game_data_prepared", outputDir] UTF8String]); + system([[NSString stringWithFormat:@"touch \"%@/game_data_prepared\"", outputDir] UTF8String]); [self showProgressText:@"Installation complete"]; [self.installButton setTitle:@"Run VCMI"];