mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
When looking for an icon, check if it is a symbolic link and get the icon of its destination. Behaviour verified on Apple
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39480 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
79e6bc01af
commit
3dc638d6b6
2 changed files with 28 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-03-08 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m (iconForFile)
|
||||
When looking for an icon, check if it is a symbolic link and get the icon of its destination. Behaviour verified on Apple.
|
||||
|
||||
2016-02-16 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m (mountNewRemovableMedia)
|
||||
|
|
|
@ -1365,8 +1365,29 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
|||
NSDictionary *attributes;
|
||||
NSString *fileType;
|
||||
|
||||
attributes = [mgr fileAttributesAtPath: fullPath traverseLink: YES];
|
||||
fileType = [attributes objectForKey: NSFileType];
|
||||
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)
|
||||
{
|
||||
NSString *linkPath;
|
||||
|
||||
linkPath = [mgr pathContentOfSymbolicLinkAtPath:fullPath];
|
||||
if ([linkPath isAbsolutePath])
|
||||
fullPath = linkPath;
|
||||
else
|
||||
fullPath = [[[fullPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:linkPath] stringByStandardizingPath];
|
||||
|
||||
/* now we reget the target attributes */
|
||||
attributes = [mgr fileAttributesAtPath: fullPath traverseLink: NO];
|
||||
fileType = [attributes fileType];
|
||||
}
|
||||
|
||||
if ([fileType isEqual: NSFileTypeDirectory] == YES)
|
||||
{
|
||||
NSString *iconPath = nil;
|
||||
|
|
Loading…
Reference in a new issue