Permalink
Browse files

Include name of symbolic link in favorites chooser

This is only when the name of the symbolic link is different from what it points to.

Closes #1272.
  • Loading branch information...
sorbits committed Nov 6, 2014
1 parent f65cba8 commit 6f5b02f994617781d56ff521a5085c929ced115b
Showing with 18 additions and 4 deletions.
  1. +18 −4 Applications/TextMate/src/Favorites.mm
@@ -152,23 +152,37 @@ - (void)loadItems:(id)sender
std::string const path = path::resolve(path::join(favoritesPath, entry->d_name));
if(strncmp("[DIR] ", entry->d_name, 6) == 0)
{
bool includeSymlinkName = path::name(path) != std::string(entry->d_name + 6);
for(auto const& subentry : path::entries(path))
{
if(subentry->d_type == DT_DIR)
{
[items addObject:@{
NSMutableDictionary* item = [NSMutableDictionary dictionaryWithDictionary:@{
@"path" : [NSString stringWithCxxString:path::join(path, subentry->d_name)],
@"isRemoveDisabled" : @YES
}];
if(includeSymlinkName)
item[@"name"] = [NSString stringWithFormat:@"%s%s", subentry->d_name, entry->d_name + 6];
[items addObject:item];
}
}
}
else
{
[items addObject:@{
NSMutableDictionary* item = [NSMutableDictionary dictionaryWithDictionary:@{
@"path" : [NSString stringWithCxxString:path],
@"link" : [NSString stringWithCxxString:path::join(favoritesPath, entry->d_name)]
}];
if(path::name(path) != entry->d_name)
{
item[@"name"] = [NSString stringWithCxxString:entry->d_name];
item[@"folder"] = [item[@"path"] stringByAbbreviatingWithTildeInPath];
}
[items addObject:item];
}
}
}
@@ -181,8 +195,8 @@ - (void)loadItems:(id)sender
NSMutableDictionary* tmp = [item mutableCopy];
[tmp addEntriesFromDictionary:@{
@"icon" : [OakFileIconImage fileIconImageWithPath:path size:NSMakeSize(32, 32)],
@"name" : [NSString stringWithCxxString:path::display_name(to_s(path))],
@"folder" : [[path stringByDeletingLastPathComponent] stringByAbbreviatingWithTildeInPath],
@"name" : item[@"name"] ?: [NSString stringWithCxxString:path::display_name(to_s(path))],
@"folder" : item[@"folder"] ?: [[path stringByDeletingLastPathComponent] stringByAbbreviatingWithTildeInPath],
@"info" : [path stringByAbbreviatingWithTildeInPath]
}];
[_originalItems addObject:tmp];

0 comments on commit 6f5b02f

Please sign in to comment.