Revision: 6877
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6877&view=rev
Author:   hofman
Date:     2010-10-19 10:46:38 +0000 (Tue, 19 Oct 2010)

Log Message:
-----------
better determination of guess for file name of not yet downloaded URL

Modified Paths:
--------------
    trunk/SKDownload.m

Modified: trunk/SKDownload.m
===================================================================
--- trunk/SKDownload.m  2010-10-17 09:51:36 UTC (rev 6876)
+++ trunk/SKDownload.m  2010-10-19 10:46:38 UTC (rev 6877)
@@ -39,6 +39,8 @@
 #import "SKDownload.h"
 #import <ApplicationServices/ApplicationServices.h>
 #import "NSFileManager_SKExtensions.h"
+#import "NSURL_SKExtensions.h"
+#import "NSString_SKExtensions.h"
 
 NSString *SKDownloadFileNameKey = @"fileName";
 NSString *SKDownloadStatusKey = @"status";
@@ -166,7 +168,17 @@
 }
 
 - (NSString *)fileName {
-    return [([self filePath] ?: [[self URL] path]) lastPathComponent];
+    NSString *fileName = [filePath lastPathComponent];
+    if (fileName == nil) {
+        if ([[URL path] length] > 1) {
+            fileName = [URL lastPathComponent];
+        } else {
+            fileName = [URL host];
+            if (fileName == nil)
+                fileName = [[[URL resourceSpecifier] lastPathComponent] 
stringByReplacingPercentEscapes];
+        }
+    }
+    return fileName;
 }
 
 - (NSImage *)fileIcon {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to