mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Improve finding live target app in command line driver
This commit is contained in:
1 parent
fdee19ec69
commit
65e2bac89e
1 file changed
+11
-8
@@ -201,14 +201,17 @@
|
||||
|
||||
- (NSRunningApplication *)targetRunningApplication
|
||||
{
|
||||
NSArray<NSRunningApplication *> *runningApplications = [[NSWorkspace sharedWorkspace] runningApplications];
|
||||
// Make sure we *don't* use NSURLs for equality comparison; turns out to not work that great
|
||||
NSString *bundlePath = self.bundle.bundleURL.path;
|
||||
if (bundlePath != nil) {
|
||||
for (NSRunningApplication *runningApplication in runningApplications) {
|
||||
NSString *candidatePath = runningApplication.bundleURL.path;
|
||||
if (candidatePath != nil && [bundlePath isEqualToString:candidatePath]) {
|
||||
return runningApplication;
|
||||
NSString *bundleIdentifier = self.bundle.bundleIdentifier;
|
||||
if (bundleIdentifier != nil) {
|
||||
NSArray<NSRunningApplication *> *runningApplications = [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
||||
// Make sure we *don't* use NSURLs for equality comparison; turns out to not work that great
|
||||
NSString *bundlePath = self.bundle.bundleURL.path;
|
||||
if (bundlePath != nil) {
|
||||
for (NSRunningApplication *runningApplication in runningApplications) {
|
||||
NSString *candidatePath = runningApplication.bundleURL.path;
|
||||
if (candidatePath != nil && [bundlePath isEqualToString:candidatePath]) {
|
||||
return runningApplication;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user