From 406600e49143866d24c1b7583a7611b3ffda8259 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 11 Nov 2006 20:00:50 +0000 Subject: [PATCH] If the folder doesn't exist, still show a folder icon for the download/incomplete folder prefs. --- Transmission.xcodeproj/project.pbxproj | 2 +- macosx/ExpandedPathToIconTransformer.m | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index 72afb9de7..d931921b2 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -262,7 +262,7 @@ 4DAB87C40ABE1F730081CF7E /* http.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = http.c; path = libtransmission/http.c; sourceTree = ""; }; 4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = ""; }; 4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = ""; }; - 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; }; + 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; }; 4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = ""; }; 4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = ""; }; 4DDFDD21099A5D8E00189D81 /* UploadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = UploadBadge.png; path = macosx/Images/UploadBadge.png; sourceTree = ""; }; diff --git a/macosx/ExpandedPathToIconTransformer.m b/macosx/ExpandedPathToIconTransformer.m index cc9fbbcf0..f68a2c566 100644 --- a/macosx/ExpandedPathToIconTransformer.m +++ b/macosx/ExpandedPathToIconTransformer.m @@ -18,7 +18,14 @@ if (!value) return nil; - NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFile: [value stringByExpandingTildeInPath]]; + NSString * path = [value stringByExpandingTildeInPath]; + NSImage * icon; + //show a folder icon if the folder doesn't exist + if (![[NSFileManager defaultManager] fileExistsAtPath: path] && [[path pathExtension] isEqualToString: @""]) + icon = [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode('fldr')]; + else + icon = [[NSWorkspace sharedWorkspace] iconForFile: [value stringByExpandingTildeInPath]]; + [icon setScalesWhenResized: YES]; [icon setSize: NSMakeSize(16.0, 16.0)];