Revision: 18530
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18530&view=rev
Author:   hofman
Date:     2012-03-03 18:54:08 +0000 (Sat, 03 Mar 2012)
Log Message:
-----------
ignore folders for export of bibtex and papers archive

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

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2012-03-03 15:28:23 UTC (rev 18529)
+++ trunk/bibdesk/BibDocument.m 2012-03-03 18:54:08 UTC (rev 18530)
@@ -1301,15 +1301,17 @@
     NSString *targetName = [[saveTargetURL lastPathComponent] 
stringByDeletingPathExtension];
     NSString *folderPath = [dirPath stringByAppendingPathComponent:targetName];
     NSFileManager *fm = [NSFileManager defaultManager];
+    NSWorkspace *ws = [NSWorkspace sharedWorkspace];
     NSString *filePath;
     NSString *commonParent = nil;
     BOOL success = YES;
+    BOOL isDir;
     NSMutableSet *localFiles = [NSMutableSet set];
     
     if ((success = [fm createDirectoryAtPath:folderPath 
withIntermediateDirectories:NO attributes:nil error:NULL])) {
         for (BibItem *item in [self publicationsForSaving]) {
             for (BDSKLinkedFile *file in [item localFiles]) {
-                if ((filePath = [file path])) {
+                if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] 
&& [ws isFolderAtPath:filePath] == NO) {
                     [localFiles addObject:filePath];
                     if (commonParent)
                         commonParent = [[filePath 
stringByDeletingLastPathComponent] commonRootPathOfFile:commonParent];
@@ -1326,16 +1328,14 @@
         
         for (filePath in localFiles) {
             if (success == NO) break;
-            if ([fm fileExistsAtPath:filePath]) {
-                NSString *relativePath = commonParent ? [filePath 
relativePathFromPath:commonParent] : [filePath lastPathComponent];
-                NSString *targetPath = [folderPath 
stringByAppendingPathComponent:relativePath];
-                
-                if ([fm fileExistsAtPath:targetPath])
-                    targetPath = [fm uniqueFilePathWithName:[targetPath 
stringByDeletingLastPathComponent] atPath:[targetPath lastPathComponent]];
-                success = [fm createPathToFile:targetPath attributes:nil];
-                if (success)
+            NSString *relativePath = commonParent ? [filePath 
relativePathFromPath:commonParent] : [filePath lastPathComponent];
+            NSString *targetPath = [folderPath 
stringByAppendingPathComponent:relativePath];
+            
+            if ([fm fileExistsAtPath:targetPath])
+                targetPath = [fm uniqueFilePathWithName:[targetPath 
stringByDeletingLastPathComponent] atPath:[targetPath lastPathComponent]];
+            success = [fm createPathToFile:targetPath attributes:nil];
+            if (success)
                 success = [fm copyItemAtPath:filePath toPath:targetPath 
error:NULL];
-            }
         }
         
         if (success) {

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


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to