diff options
-rw-r--r-- | uicache.mm | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -225,10 +225,24 @@ bool appIsRegistered(NSString *path) bool unregisterPath(NSString *path) { @autoreleasepool { + NSURL *url = nil; if (verbose) fprintf(stderr, "Unregistering %s\n", path.lastPathComponent.UTF8String); - path = getAppPath(path); - if (!path) return false; - if (appIsRegistered(path) && ![workspace unregisterApplication:[NSURL fileURLWithPath:path]]) { + if (![path hasPrefix:@"/"]) { + // Maybe it's an app_id + LSApplicationProxy *app = [LSApplicationProxy applicationProxyForIdentifier:path]; + if (app) { + url = [app bundleURL]; + if (verbose) fprintf(stderr, "Resolved bundle ID %s to path %s\n", path.UTF8String, [url fileSystemRepresentation]); + path = [url path]; + } + } else { + path = getAppPath(path); + if (path) { + url = [NSURL fileURLWithPath:path]; + } + } + if (!url) return false; + if (appIsRegistered(path) && ![workspace unregisterApplication:url]) { fprintf(stderr, "Error: unregisterApplication failed for %s\n", path.lastPathComponent.UTF8String); return false; } |