mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	A patch from stopiccot http://forum.vcmi.eu/viewtopic.php?p=8340#8340
This commit is contained in:
		| @@ -17,7 +17,6 @@ | |||||||
| 	using namespace boost::filesystem; | 	using namespace boost::filesystem; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| /// Where to find the various VCMI files. This is mostly useful for linux.  | /// Where to find the various VCMI files. This is mostly useful for linux.  | ||||||
| class VCMIDirs { | class VCMIDirs { | ||||||
| public: | public: | ||||||
| @@ -31,6 +30,17 @@ public: | |||||||
| 		try { | 		try { | ||||||
| #ifdef ANDROID | #ifdef ANDROID | ||||||
| 			UserPath = DATA_DIR; | 			UserPath = DATA_DIR; | ||||||
|  | #elif defined(__APPLE__) | ||||||
|  |             // This is Cocoa code that should be normally used to get path to Application Support folder but can't use it here for now... | ||||||
|  |             // NSArray* urls = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; | ||||||
|  |             // UserPath = path([urls[0] path] + "/vcmi").string(); | ||||||
|  |              | ||||||
|  |             // ...so here goes a bit of hardcode instead | ||||||
|  |             std::string home_dir = "."; | ||||||
|  | 			if (getenv("HOME") != NULL ) | ||||||
|  | 				home_dir = getenv("HOME"); | ||||||
|  |              | ||||||
|  | 			UserPath = path(home_dir + "/Library/Application Support/vcmi").string(); | ||||||
| #else | #else | ||||||
| 			// Find vcmi user directory and create it if necessary | 			// Find vcmi user directory and create it if necessary | ||||||
| 			std::string home_dir = "."; | 			std::string home_dir = "."; | ||||||
|   | |||||||
| @@ -7,6 +7,10 @@ | |||||||
|     installationCompleted = NO; |     installationCompleted = NO; | ||||||
|     outputDir = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/../../Data"]; |     outputDir = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/../../Data"]; | ||||||
|     tempDir = NSTemporaryDirectory(); |     tempDir = NSTemporaryDirectory(); | ||||||
|  |      | ||||||
|  |     // Output to Application Support | ||||||
|  |     //NSArray* appSupportDirs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; | ||||||
|  |     //outputDir = [[appSupportDirs[0] path] stringByAppendingString:@"/vcmi"]; | ||||||
| } | } | ||||||
|  |  | ||||||
| - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender | ||||||
| @@ -243,7 +247,20 @@ | |||||||
|     [self.installButton setTitle:@"Run VCMI"]; |     [self.installButton setTitle:@"Run VCMI"]; | ||||||
|     [self.progressIndicator stopAnimation:self]; |     [self.progressIndicator stopAnimation:self]; | ||||||
|      |      | ||||||
|  |     // Notify user that installation completed | ||||||
|  |     NSUserNotification* notification = [[NSUserNotification alloc] init]; | ||||||
|  |     if (notification != nil) { | ||||||
|  |         // On OS X 10.8 and newer use notification center | ||||||
|  |         [notification setTitle:@"VCMI"]; | ||||||
|  |         [notification setInformativeText:@"Installation completed"]; | ||||||
|  |         [notification setDeliveryDate:[NSDate dateWithTimeInterval:0 sinceDate:[NSDate date]]]; | ||||||
|  |         [notification setSoundName:NSUserNotificationDefaultSoundName]; | ||||||
|  |         NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; | ||||||
|  |         [center scheduleNotification:notification]; | ||||||
|  |     } else { | ||||||
|  |         // On older OS X version force dock icon to jump | ||||||
|         [NSApp requestUserAttention:NSCriticalRequest]; |         [NSApp requestUserAttention:NSCriticalRequest]; | ||||||
|  |     } | ||||||
|      |      | ||||||
|     // Hide all progress related controls |     // Hide all progress related controls | ||||||
|     [self.progressIndicator setHidden:YES]; |     [self.progressIndicator setHidden:YES]; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user