Skip to content
Browse files

Fixing feature that normalizes installed app names and disabling it b…

…y default. Fixes #133.
  • Loading branch information...
1 parent 73e96cd commit 1bc38343458469dc77d0dd28bebd99a4a7697d22 @andymatuschak andymatuschak committed Jan 17, 2012
Showing with 6 additions and 4 deletions.
  1. +1 −1 SUConstants.h
  2. +5 −3 SUHost.m
View
2 SUConstants.h
@@ -24,7 +24,7 @@
// If your app file on disk is named "MyApp 1.1b4", Sparkle usually updates it
// in place, giving you an app named 1.1b4 that is actually 1.2. Turn the
// following on to always reset the name back to "MyApp":
-#define NORMALIZE_INSTALLED_APP_NAME 1
+#define NORMALIZE_INSTALLED_APP_NAME 0
#define TRY_TO_APPEND_VERSION_NUMBER 1
View
8 SUHost.m
@@ -63,10 +63,12 @@ - (NSString *)appSupportPath
- (NSString *)installationPath
{
#if NORMALIZE_INSTALLED_APP_NAME
- return [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat: @"%@.%@", [bundle objectForInfoDictionaryKey:@"CFBundleName"], [[bundle bundlePath] pathExtension]]];
-#else
- return [bundle bundlePath];
+ // We'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
+ NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat: @"%@.%@", [bundle objectForInfoDictionaryKey:@"CFBundleName"], [[bundle bundlePath] pathExtension]]];
+ if (![[NSFileManager defaultManager] fileExistsAtPath:[[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat: @"%@.%@", [bundle objectForInfoDictionaryKey:@"CFBundleName"], [[bundle bundlePath] pathExtension]]]])
+ return normalizedAppPath;
#endif
+ return [bundle bundlePath];
}
- (NSString *)name

0 comments on commit 1bc3834

Please sign in to comment.
Something went wrong with that request. Please try again.