1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

patch from stoppicot:

1. vcmiclient now usese custom Info.plist 
 2. Original H3 game data is now also stored in Application Support folder
This commit is contained in:
Ivan Savenko 2013-02-06 15:39:34 +00:00
parent 3958364884
commit 56ffd05648
4 changed files with 20 additions and 7 deletions

View File

@ -189,7 +189,8 @@ int main(int argc, char** argv)
std::string workDir = executablePath.substr(0, executablePath.rfind('/')); std::string workDir = executablePath.substr(0, executablePath.rfind('/'));
chdir(workDir.c_str()); 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) { if (check == NULL) {
system("open ./vcmibuilder.app"); system("open ./vcmibuilder.app");
return 0; return 0;

View File

@ -47,14 +47,16 @@ if(WIN32)
add_executable(vcmiclient WIN32 ${client_SRCS}) add_executable(vcmiclient WIN32 ${client_SRCS})
elseif(APPLE) elseif(APPLE)
# When building for OS X we need add SDLMain.m to source files # 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 # 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) 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 # Copy icon file
set(MACOSX_BUNDLE_ICON_FILE vcmi.icns) set_source_files_properties(vcmi.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/vcmi.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# Copy server executable, libs and game data to bundle # Copy server executable, libs and game data to bundle
set(BUNDLE_PATH ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiclient.app/Contents) set(BUNDLE_PATH ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiclient.app/Contents)

10
client/Info.plist Normal file
View File

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

View File

@ -9,8 +9,8 @@
tempDir = NSTemporaryDirectory(); tempDir = NSTemporaryDirectory();
// Output to Application Support // Output to Application Support
//NSArray* appSupportDirs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; NSArray* appSupportDirs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask];
//outputDir = [[appSupportDirs[0] path] stringByAppendingString:@"/vcmi"]; outputDir = [[appSupportDirs[0] path] stringByAppendingString:@"/vcmi"];
} }
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender - (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 // After everythin is complete we create marker file. VCMI will look for this file to exists on startup and
// will run this setup otherwise // 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 showProgressText:@"Installation complete"];
[self.installButton setTitle:@"Run VCMI"]; [self.installButton setTitle:@"Run VCMI"];