Răsfoiți Sursa

patch from stoppicot:
1. vcmiclient now usese custom Info.plist
2. Original H3 game data is now also stored in Application Support folder

Ivan Savenko 12 ani în urmă
părinte
comite
56ffd05648

+ 2 - 1
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;

+ 5 - 3
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)

+ 10 - 0
client/Info.plist

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+    <key>CFBundleIconFile</key>
+    <string>vcmi.icns</string>
+    <key>CFBundleVersion</key>
+    <string>0.91</string>
+</dict>
+</plist>

+ 3 - 3
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"];