Skip to content

Commit

Permalink
label for foo.app is foo
Browse files Browse the repository at this point in the history
Revert "Remove failing test for Safari label"
This reverts commit 55abc88.

Restores code from 9245f0a
  • Loading branch information
n8henrie committed Mar 19, 2023
1 parent 55abc88 commit 260eee3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Quicksilver/Code-QuickStepCore/QSObject_FileHandling.m
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,12 @@ - (void)getNameFromFiles {
[self setName:newName];

// generally: name = what you see in Terminal, label = what you see in Finder

NSString *newLabel = [[self infoRecord] objectForKey:NSURLLocalizedNameKey];
if ([[newLabel pathExtension] isEqualToString:@"app"]) {
// most apps just remove the extension
newLabel = [newLabel stringByDeletingPathExtension];
}

if (UTTypeConformsTo((__bridge CFStringRef)[self fileUTI], (CFStringRef)@"com.apple.systempreference.prefpane")) {
// get the CFBundleName for preference panes
newLabel = [[NSBundle bundleWithPath:path] localizedInfoDictionary][@"CFBundleName"];
Expand Down
3 changes: 2 additions & 1 deletion Quicksilver/Tests/Tests-QSCore/QSFileObjectTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ - (void)testFileNaming
// label is localized, so this test might only work for a specific locale
path = @"/Applications/Safari.app";
object = [QSObject fileObjectWithPath:path];
XCTAssertEqualObjects([object name], @"Safari.app");
XCTAssertEqualObjects([object name], @"Safari.app", @"");
XCTAssertEqualObjects([object label], @"Safari", @"");

path = @"/System/Library/PreferencePanes/Accounts.prefPane";
object = [QSObject fileObjectWithPath:path];
Expand Down

0 comments on commit 260eee3

Please sign in to comment.