Revision: 10950
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=10950&view=rev
Author:   hofman
Date:     2007-08-20 01:58:13 -0700 (Mon, 20 Aug 2007)

Log Message:
-----------
Supply a unique basename for a temporary folder when the passed in value is nil 
rather than assert it to be non-nil. The script group passes nil.

Modified Paths:
--------------
    trunk/bibdesk/NSFileManager_BDSKExtensions.m

Modified: trunk/bibdesk/NSFileManager_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSFileManager_BDSKExtensions.m        2007-08-20 05:12:19 UTC 
(rev 10949)
+++ trunk/bibdesk/NSFileManager_BDSKExtensions.m        2007-08-20 08:58:13 UTC 
(rev 10950)
@@ -250,10 +250,15 @@
 
 // This method is subject to a race condition in our temporary directory if we 
pass the same baseName to this method and temporaryFileWithBasename: 
simultaneously; hence the lock in uniqueFilePathWithName:atPath:, even though 
it and temporaryFileWithBasename: are not thread safe or secure.
 - (NSString *)makeTemporaryDirectoryWithBasename:(NSString *)baseName {
-    NSParameterAssert(baseName != nil);
     NSString *finalPath = nil;
     
     @synchronized(self) {
+        if (baseName == nil) {
+            CFUUIDRef uuid = CFUUIDCreate(NULL);
+            baseName = [(NSString *)CFUUIDCreateString(NULL, uuid) 
autorelease];
+            CFRelease(uuid);
+        }
+        
         unsigned i = 0;
         NSURL *fileURL = [NSURL fileURLWithPath:[temporaryBaseDirectory 
stringByAppendingPathComponent:baseName]];
         while ([self objectExistsAtFileURL:fileURL]) {


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to