[Scummvm-cvs-logs] scummvm branch-1-8 -> 6b2eab61642fb48068aa49feb48be3dded965c7b

sev- sev at scummvm.org
Sun Apr 10 11:04:52 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:
ef5e63ae93 UPDATES: Use new constants for MacOS X 10.10
6b2eab6164 UPDATES: Check that we're running in a bundle, and skip Sparkle initialization otherwise


Commit: ef5e63ae936063bde28987153167fdf0485f2e82
    https://github.com/scummvm/scummvm/commit/ef5e63ae936063bde28987153167fdf0485f2e82
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-10T11:04:39+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: 6b2eab61642fb48068aa49feb48be3dded965c7b
    https://github.com/scummvm/scummvm/commit/6b2eab61642fb48068aa49feb48be3dded965c7b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-10T11:04:39+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