Update of /cvsroot/audacity/audacity-src/src/export
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv4832

Modified Files:
        Export.cpp 
Log Message:
Pass real file name to exporters
Prevent (possibly BIG) delay on Windows if the output file already exixts 
(wxRenameFile() as to copy it)

Index: Export.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/Export.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- Export.cpp  26 Apr 2007 05:50:31 -0000      1.55
+++ Export.cpp  5 May 2007 07:33:09 -0000       1.56
@@ -299,11 +299,6 @@
       mMixerSpec = NULL;
    }
 
-   // Rename file, if needed
-   if (success && mActualName != mFilename) {
-      ::wxRenameFile(mFilename.GetFullPath(), mActualName.GetFullPath());
-   }
-
    return success;
 }
 
@@ -611,13 +606,34 @@
 
 bool Export::ExportTracks()
 {
-   return mTypes[mFormat].Export(mProject,
-                                 mChannels,
-                                 mFilename.GetFullPath(),
-                                 mSelectedOnly,
-                                 mT0,
-                                 mT1,
-                                 mMixerSpec);
+   bool success;
+
+   // Keep original in case of failure
+   if (mActualName != mFilename) {
+      ::wxRenameFile(mActualName.GetFullPath(), mFilename.GetFullPath());
+   }
+
+   success = mTypes[mFormat].Export(mProject,
+                                    mChannels,
+                                    mActualName.GetFullPath(),
+                                    mSelectedOnly,
+                                    mT0,
+                                    mT1,
+                                    mMixerSpec);
+
+   if (mActualName != mFilename) {
+      // Remove backup
+      if (success) {
+         ::wxRemoveFile(mFilename.GetFullPath());
+      }
+      else {
+         // Restore original, if needed
+         ::wxRemoveFile(mActualName.GetFullPath());
+         ::wxRenameFile(mFilename.GetFullPath(), mActualName.GetFullPath());
+      }
+   }
+
+   return success;
 }
 
 //----------------------------------------------------------------------------


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to