Skip to content

Commit

Permalink
feat: improve pkgx binary detection
Browse files Browse the repository at this point in the history
- Add user-specific installation path (~/.local/bin/pkgx)
- Use isExecutableFileAtPath for proper binary permission check
  • Loading branch information
stevenlei committed Dec 27, 2024
1 parent e23abae commit 90e67bc
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 @@ -69,8 +69,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;
}

@end

0 comments on commit 90e67bc

Please sign in to comment.