mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
A patch from stopiccot http://forum.vcmi.eu/viewtopic.php?p=8340#8340
This commit is contained in:
parent
a9d458c8f4
commit
59abcac7da
@ -17,7 +17,6 @@
|
||||
using namespace boost::filesystem;
|
||||
#endif
|
||||
|
||||
|
||||
/// Where to find the various VCMI files. This is mostly useful for linux.
|
||||
class VCMIDirs {
|
||||
public:
|
||||
@ -31,6 +30,17 @@ public:
|
||||
try {
|
||||
#ifdef ANDROID
|
||||
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
|
||||
// Find vcmi user directory and create it if necessary
|
||||
std::string home_dir = ".";
|
||||
|
@ -7,6 +7,10 @@
|
||||
installationCompleted = NO;
|
||||
outputDir = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/../../Data"];
|
||||
tempDir = NSTemporaryDirectory();
|
||||
|
||||
// Output to Application Support
|
||||
//NSArray* appSupportDirs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask];
|
||||
//outputDir = [[appSupportDirs[0] path] stringByAppendingString:@"/vcmi"];
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender
|
||||
@ -243,7 +247,20 @@
|
||||
[self.installButton setTitle:@"Run VCMI"];
|
||||
[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];
|
||||
}
|
||||
|
||||
// Hide all progress related controls
|
||||
[self.progressIndicator setHidden:YES];
|
||||
|
Loading…
Reference in New Issue
Block a user