diff options
author | Sam Bingner <sam@bingner.com> | 2021-02-19 00:37:20 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2021-02-19 00:49:56 -1000 |
commit | 66e7e9bf29052d784fb71c65589574d5fd15b3b6 (patch) | |
tree | 74f410353c6248f6aa0e3f66dc73f9571e69e4eb | |
parent | b5ff1c1916246fbfb4348e81d53aa932bddcea7d (diff) |
Make uicache -u support bundle ID
-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; } |