Skip to content

Commit

Permalink
Fixing feature that normalizes installed app names and disabling it b…
Browse files Browse the repository at this point in the history
…y default. Fixes sparkle-project#133.
  • Loading branch information
andymatuschak committed Jan 18, 2012
1 parent 73e96cd commit 1bc3834
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SUConstants.h
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions SUHost.m
Expand Up @@ -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
Expand Down

0 comments on commit 1bc3834

Please sign in to comment.