Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

pull-request to help plugin/bundle developers avoid class collisions #22

Closed
wants to merge 2 commits into from

3 participants

Rudy Richter Jake Petroules Kornel
Rudy Richter

added defines to prefix all the class names with the contents of the ClassPrefix preprocessor macro so that plugin/bundle developers can avoid namespace collisions with the app and other plugin authors that make use of Sparkle.

Jake Petroules

This could potentially be useful. @pornel, thoughts?

Kornel
Owner

It's a hack, so I'd rather not do this unless there's a clear need for it, and given that there hasn't been a ton of +1s on this issue since 2011, it may not be worth it.

Current Apple's recommendations are to use 3-letter name prefix (which won't collide with Sparkle's 2-letter prefix), and Swift will be immune to this problem.

Kornel pornel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 20, 2011
  1. Rudy Richter

    Introduces the ability to prefix the sparkle classes in a simple way …

    rudyrichter authored
    …that makes Sparkle safely useable in bundles/plugins
  2. Rudy Richter
This page is out of date. Refresh to see the latest.
Showing with 56 additions and 0 deletions.
  1. +56 −0 Sparkle.pch
56 Sparkle.pch
View
@@ -20,6 +20,62 @@
#ifdef __OBJC__
+#ifdef ClassPrefix
+#define _ClassPrefix_CONCAT_2(c,d) c ## d
+#define _ClassPrefix_CONCAT(a,b) _ClassPrefix_CONCAT_2(a,b)
+#define ClassPrefix_PREPEND(x) _ClassPrefix_CONCAT(ClassPrefix, x)
+
+//Update Control
+#define SUUpdater ClassPrefix_PREPEND(SUUpdater)
+//Drivers
+#define SUUpdateDriver ClassPrefix_PREPEND(SUUpdateDriver)
+#define SUBasicUpdateDriver ClassPrefix_PREPEND(SUBasicUpdateDriver)
+#define SUUIBasedUpdateDriver ClassPrefix_PREPEND(SUUIBasedUpdateDriver)
+#define SUAutomaticUpdateDriver ClassPrefix_PREPEND(SUAutomaticUpdateDriver)
+#define SUScheduledUpdateDriver ClassPrefix_PREPEND(SUScheduledUpdateDriver)
+#define SUProbingUpdateDriver ClassPrefix_PREPEND(SUProbingUpdateDriver)
+#define SUUserInitiatedUpdateDriver ClassPrefix_PREPEND(SUUserInitiatedUpdateDriver)
+//Support
+#define SUDSAVerifier ClassPrefix_PREPEND(SUDSAVerifier)
+
+//Appcast Support
+#define SUAppcast ClassPrefix_PREPEND(SUAppcast)
+#define SUAppcastExtensions ClassPrefix_PREPEND(SUAppcastExtensions)
+#define SUAppcastItem ClassPrefix_PREPEND(SUAppcastItem)
+#define SUSystemProfiler ClassPrefix_PREPEND(SUSystemProfiler)
+#define SUVersionComparison ClassPrefix_PREPEND(SUVersionComparison)
+#define SUStandardVersionComparator ClassPrefix_PREPEND(SUStandardVersionComparator)
+
+//Installation
+#define SUInstaller ClassPrefix_PREPEND(SUInstaller)
+#define SUPlainInstaller ClassPrefix_PREPEND(SUPlainInstaller)
+#define SUPlainInstallerInternals ClassPrefix_PREPEND(SUPlainInstallerInternals)
+#define SUPackageInstaller ClassPrefix_PREPEND(SUPackageInstaller)
+
+
+//Unarchiving
+//Binary Delta
+#define SUBinaryDeltaUnarchiver ClassPrefix_PREPEND(SUBinaryDeltaUnarchiver)
+
+#define SUUnarchiver ClassPrefix_PREPEND(SUUnarchiver)
+#define SUPipedUnarchiver ClassPrefix_PREPEND(SUPipedUnarchiver)
+#define SUDiskImageUnarchiver ClassPrefix_PREPEND(SUDiskImageUnarchiver)
+#define NTSynchronousTask ClassPrefix_PREPEND(NTSynchronousTask)
+
+
+//User Interface
+#define SUUpdateAlert ClassPrefix_PREPEND(SUUpdateAlert)
+#define SUAutomaticUpdateAlert ClassPrefix_PREPEND(SUAutomaticUpdateAlert)
+#define SUStatusController ClassPrefix_PREPEND(SUStatusController)
+#define SUUpdatePermissionPrompt ClassPrefix_PREPEND(SUUpdatePermissionPrompt)
+#define SUWindowController ClassPrefix_PREPEND(SUWindowController)
+
+
+//Other Sources
+#define SUHost ClassPrefix_PREPEND(SUHost)
+
+#endif
+
#define SPARKLE_BUNDLE [NSBundle bundleWithIdentifier:@"org.andymatuschak.Sparkle"]
#define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", SPARKLE_BUNDLE, comment)
#define SUAbstractFail() NSAssert2(nil, @"Can't call %@ on an instance of %@; this is an abstract method!", __PRETTY_FUNCTION__, [self class]);
Something went wrong with that request. Please try again.