Fixing feature that normalizes installed app names and disabling it by default. Fixes #133.

This commit is contained in:
Andy Matuschak committed 2012-01-17 22:39:49 -08:00
1 parent 73e96cdcab
commit 1bc3834345
2 files changed
+6 -4

No files matched your search

+1 -1
View File
@@ -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
+5 -3
View File
@@ -63,10 +63,12 @@
- (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