Always traverse links explicitely and get the original path to do icon lookup, not just for Symliks. The symlink may be infact in the middle of the path, not just the last one

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39525 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2016-03-10 22:59:46 +00:00
parent e00f1870c6
commit 93018cffb2
2 changed files with 10 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2016-03-10 Riccardo Mottola <rm@gnu.org>
* Source/NSWorkspace.m
Always traverse links explicitely and get the original path to do icon lookup, not just for Symliks. The symlink may be infact in the middle of the path, not just the last one.
2016-03-10 Riccardo Mottola <rm@gnu.org>
* Source/NSWorkspace.m

View file

@ -1384,23 +1384,17 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
NSDictionary *attributes;
NSString *fileType;
attributes = [mgr fileAttributesAtPath: fullPath traverseLink: NO];
fileType = [attributes fileType];
/*
If we have a symobolic link, get not only the original path attributes,
but also the original path, to resolve the correct icon.
mac resolves the original icon
*/
if ([fileType isEqual: NSFileTypeSymbolicLink] == YES)
{
fullPath = [fullPath stringByResolvingSymlinksInPath];
fullPath = [fullPath stringByResolvingSymlinksInPath];
/* now we get the target attributes of the traversed link */
attributes = [mgr fileAttributesAtPath: fullPath traverseLink: NO];
fileType = [attributes fileType];
/* now we reget the target attributes */
attributes = [mgr fileAttributesAtPath: fullPath traverseLink: NO];
fileType = [attributes fileType];
}
if ([fileType isEqual: NSFileTypeDirectory] == YES)
{
NSString *iconPath = nil;