[Scummvm-cvs-logs] scummvm master -> 3d256150e1c660c54591a7a1c6d6891d2b1d060c

sev- sev at scummvm.org
Sun Apr 10 11:04:56 CEST 2016


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
aa5432b0e9 UPDATES: Use new constants for MacOS X 10.10
3d256150e1 UPDATES: Check that we're running in a bundle, and skip Sparkle initialization otherwise


Commit: aa5432b0e9c1545c4e7f952864eb542e4a3953f8
    https://github.com/scummvm/scummvm/commit/aa5432b0e9c1545c4e7f952864eb542e4a3953f8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-10T10:50:59+02:00

Commit Message:
UPDATES: Use new constants for MacOS X 10.10

Changed paths:
    backends/updates/macosx/macosx-updates.mm



diff --git a/backends/updates/macosx/macosx-updates.mm b/backends/updates/macosx/macosx-updates.mm
index a7888a7..64d1028 100644
--- a/backends/updates/macosx/macosx-updates.mm
+++ b/backends/updates/macosx/macosx-updates.mm
@@ -33,6 +33,8 @@
 #include <Cocoa/Cocoa.h>
 #include <Sparkle/Sparkle.h>
 
+#include <AvailabilityMacros.h>
+
 SUUpdater *sparkleUpdater;
 
 /**
@@ -136,8 +138,13 @@ int MacOSXUpdateManager::getUpdateCheckInterval() {
 
 bool MacOSXUpdateManager::getLastUpdateCheckTimeAndDate(TimeDate &t) {
 	NSDate *date = [sparkleUpdater lastUpdateCheckDate];
+#ifdef MAC_OS_X_VERSION_10_10
+	NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
+	NSDateComponents *components = [gregorian components:(NSCalendarUnitDay | NSCalendarUnitWeekday) fromDate:date];
+#else
 	NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
 	NSDateComponents *components = [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:date];
+#endif
 
 	t.tm_wday = [components weekday];
 	t.tm_year = [components year];


Commit: 3d256150e1c660c54591a7a1c6d6891d2b1d060c
    https://github.com/scummvm/scummvm/commit/3d256150e1c660c54591a7a1c6d6891d2b1d060c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-10T11:02:54+02:00

Commit Message:
UPDATES: Check that we're running in a bundle, and skip Sparkle initialization otherwise

This was leading to an unhandled exception within Sparkle code
which was hanging the application. This feature is good only for development
purposes, as convenient users are supposed to run ScummVM from the
supplied bundle.

Changed paths:
    backends/updates/macosx/macosx-updates.mm



diff --git a/backends/updates/macosx/macosx-updates.mm b/backends/updates/macosx/macosx-updates.mm
index 64d1028..db9362a 100644
--- a/backends/updates/macosx/macosx-updates.mm
+++ b/backends/updates/macosx/macosx-updates.mm
@@ -49,14 +49,22 @@ SUUpdater *sparkleUpdater;
  *
  */
 MacOSXUpdateManager::MacOSXUpdateManager() {
+	NSBundle* mainBundle = [NSBundle mainBundle];
+
+	NSString *version = [mainBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
+	if (!version || [version isEqualToString:@""]) {
+		warning("Running not in bundle, skipping Sparkle initialization");
+
+		sparkleUpdater = nullptr;
+		return;
+	}
+
 	NSMenuItem *menuItem = [[NSApp mainMenu] itemAtIndex:0];
 	NSMenu *applicationMenu = [menuItem submenu];
 
 	// Init Sparkle
 	sparkleUpdater = [SUUpdater sharedUpdater];
 
-	NSBundle* mainBundle = [NSBundle mainBundle];
-
 	NSString* feedbackURL = [mainBundle objectForInfoDictionaryKey:@"SUFeedURL"];
 
 	// Set appcast URL
@@ -92,6 +100,9 @@ MacOSXUpdateManager::~MacOSXUpdateManager() {
 }
 
 void MacOSXUpdateManager::checkForUpdates() {
+	if (sparkleUpdater == nullptr)
+		return;
+
 	[sparkleUpdater checkForUpdatesInBackground];
 }
 
@@ -99,10 +110,16 @@ void MacOSXUpdateManager::setAutomaticallyChecksForUpdates(UpdateManager::Update
 	if (state == kUpdateStateNotSupported)
 		return;
 
+	if (sparkleUpdater == nullptr)
+		return;
+
 	[sparkleUpdater setAutomaticallyChecksForUpdates:(state == kUpdateStateEnabled ? YES : NO)];
 }
 
 Common::UpdateManager::UpdateState MacOSXUpdateManager::getAutomaticallyChecksForUpdates() {
+	if (sparkleUpdater == nullptr)
+		return kUpdateStateDisabled;
+
 	if ([sparkleUpdater automaticallyChecksForUpdates])
 		return kUpdateStateEnabled;
 	else
@@ -110,6 +127,9 @@ Common::UpdateManager::UpdateState MacOSXUpdateManager::getAutomaticallyChecksFo
 }
 
 void MacOSXUpdateManager::setUpdateCheckInterval(int interval) {
+	if (sparkleUpdater == nullptr)
+		return;
+
 	if (interval == kUpdateIntervalNotSupported)
 		return;
 
@@ -119,6 +139,9 @@ void MacOSXUpdateManager::setUpdateCheckInterval(int interval) {
 }
 
 int MacOSXUpdateManager::getUpdateCheckInterval() {
+	if (sparkleUpdater == nullptr)
+		return kUpdateIntervalOneDay;
+
 	// This is kind of a hack but necessary, as the value stored by Sparkle
 	// might have been changed outside of ScummVM (in which case we return the
 	// default interval of one day)
@@ -137,6 +160,9 @@ int MacOSXUpdateManager::getUpdateCheckInterval() {
 }
 
 bool MacOSXUpdateManager::getLastUpdateCheckTimeAndDate(TimeDate &t) {
+	if (sparkleUpdater == nullptr)
+		return false;
+
 	NSDate *date = [sparkleUpdater lastUpdateCheckDate];
 #ifdef MAC_OS_X_VERSION_10_10
 	NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];






More information about the Scummvm-git-logs mailing list