Revision: 3989
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3989&view=rev
Author:   hofman
Date:     2008-06-08 05:07:24 -0700 (Sun, 08 Jun 2008)

Log Message:
-----------
Create downloads path instead of URL.

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

Modified: trunk/Files_SKExtensions.h
===================================================================
--- trunk/Files_SKExtensions.h  2008-06-08 10:09:45 UTC (rev 3988)
+++ trunk/Files_SKExtensions.h  2008-06-08 12:07:24 UTC (rev 3989)
@@ -40,7 +40,7 @@
 
 // This function is not thread safe
 
-extern NSURL *SKDownloadFolderURL();
+NSString *SKDownloadDirectory();
 
 // These functions are thread safe
 

Modified: trunk/Files_SKExtensions.m
===================================================================
--- trunk/Files_SKExtensions.m  2008-06-08 10:09:45 UTC (rev 3988)
+++ trunk/Files_SKExtensions.m  2008-06-08 12:07:24 UTC (rev 3989)
@@ -39,13 +39,14 @@
 #import "Files_SKExtensions.h"
 #import <Carbon/Carbon.h>
 
-NSURL *SKDownloadFolderURL() {
+NSString *SKDownloadDirectory() {
     
-       static CFURLRef downloadsURL = nil;
+       static NSString *downloadsDirectory = nil;
     
-    if (nil == downloadsURL) {
+    if (nil == downloadsDirectory) {
         OSStatus err = fnfErr;
         FSRef pathRef;
+        CFURLRef downloadsURL;
         
         if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) {
             err = FSFindFolder(kUserDomain, kDownloadsFolderType, TRUE, 
&pathRef);
@@ -69,10 +70,12 @@
                 ICStop(inst);
             }
         }
-        if(err == noErr)
-            downloadsURL = CFURLCreateFromFSRef(CFAllocatorGetDefault(), 
&pathRef);
+        if(err == noErr && (downloadsURL = 
CFURLCreateFromFSRef(CFAllocatorGetDefault(), &pathRef))) {
+            downloadsDirectory = (NSString 
*)CFURLCopyFileSystemPath(downloadsURL, kCFURLPOSIXPathStyle);
+            CFRelease(downloadsURL);
+        }
     }
-    return (NSURL *)downloadsURL;
+    return downloadsDirectory;
 }
 
 BOOL SKFileIsInTrash(NSURL *fileURL) {

Modified: trunk/SKDownload.m
===================================================================
--- trunk/SKDownload.m  2008-06-08 10:09:45 UTC (rev 3988)
+++ trunk/SKDownload.m  2008-06-08 12:07:24 UTC (rev 3989)
@@ -296,7 +296,7 @@
 }
 
 - (void)download:(NSURLDownload *)download 
decideDestinationWithSuggestedFilename:(NSString *)filename {
-    [URLDownload setDestination:[[SKDownloadFolderURL() path] 
stringByAppendingPathComponent:filename] allowOverwrite:NO];
+    [URLDownload setDestination:[SKDownloadDirectory() 
stringByAppendingPathComponent:filename] allowOverwrite:NO];
 }
 
 - (void)download:(NSURLDownload *)download didCreateDestination:(NSString 
*)path {


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to