Browse files

Work around a limitation which prevented TextMate from properly insta…

…lling our bundle upon relaunch.

Relaunching our bundle directly after it was updated made textmate try to install it twice.
Now, after updating, we restart textmate, not our bundle.
  • Loading branch information...
1 parent 94f818d commit e5e484d7701df830df6a119fce5318bc05ca128e @philc committed Apr 3, 2011
Showing with 17 additions and 1 deletion.
  1. +1 −1 README.markdown
  2. +16 −0 src/TextMateVimPlugin.m
@@ -8,7 +8,7 @@ If you've never used Vim before but you've heard that it's a way to type less to
Installation instructions
-You can install the latest release of this plugin by [downloading]( and double-clicking it.
+You can install the latest release of this plugin by [downloading]( and double-clicking it.
Alternatively, you can install it from source:
@@ -32,6 +32,9 @@ - (void)checkForNewerVersions {
// We're using the Sparkle update framework.
updater = [SUUpdater updaterForBundle:[NSBundle bundleWithIdentifier:@"textmatevim"]];
[updater resetUpdateCycle];
+ // We implement "pathToRelaunchForUpdater":
+ [updater setDelegate:self];
// Start checking right now for an update. This shouldn't be necessary according to the Sparkle docs, but
// I could never get the "automatic update scheduling" logic of Sparkle to trigger an actual update check.
[updater checkForUpdatesInBackground];
@@ -91,4 +94,17 @@ + (NSDictionary *)sendEventRouterMessage:(NSDictionary *)messageBody {
+ * This is a delegate method invoked by the Sparkle SUUpdater object. Usually it returns the path to this
+ * bundle, which will be run when textmate relaunches after our bundle has been updated. However, if we run
+ * our bundle item directly after an update, TextMate has trouble installing it. After the update, just run
+ * TextMate directly.
+ */
+- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater {
+ // NOTE(philc): I'd like access to the TM_APP_PATH which you have when running a TextMate command;
+ // hardcoding for now. If this path is incorrect, all that happens is that TextMate doesn't relaunch when
+ // you click "Update and Relaunch" when prompted to update TextMateVim.
+ return @"/Applications/";

0 comments on commit e5e484d

Please sign in to comment.