Skip to content

Commit

Permalink
Merge pull request #37 from stevenlei/feat/improve-pkgx-detection
Browse files Browse the repository at this point in the history
undefined
  • Loading branch information
mxcl authored Dec 31, 2024
2 parents 20448be + 90e67bc commit 9d5e6f5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Sources/teaBASE+Helpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,18 @@ - (BOOL)homebrewInstalled {
}

- (BOOL)pkgxInstalled {
//TODO need to check more locations
return [NSFileManager.defaultManager isReadableFileAtPath:@"/usr/local/bin/pkgx"];
NSArray *locations = @[
@"/usr/local/bin/pkgx", // system-wide
[NSString stringWithFormat:@"%@/.local/bin/pkgx", NSHomeDirectory()] // user-specific
];

NSFileManager *fm = NSFileManager.defaultManager;
for (NSString *path in locations) {
if ([fm isExecutableFileAtPath:path]) {
return YES;
}
}
return NO;
}

- (IBAction)modalCancel:(NSButton *)sender {
Expand Down

0 comments on commit 9d5e6f5

Please sign in to comment.