Initialise _soundcloud_upload to false in ExportFormatSpecification
[ardour.git] / libs / ardour / import.cc
index 48937fb576824947dbbf66e021d51ae73f22ec6f..b66f3542249bcb042e771c8e405bd97ff57fbbf4 100644 (file)
@@ -34,6 +34,7 @@
 #include <sndfile.h>
 #include <samplerate.h>
 
+#include <glib/gstdio.h>
 #include <glibmm.h>
 
 #include <boost/scoped_array.hpp>
@@ -333,6 +334,14 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
                uint32_t chn;
 
                if ((nread = source->read (data.get(), nframes)) == 0) {
+#ifdef PLATFORM_WINDOWS
+                       /* Flush the data once we've finished importing the file. Windows can  */
+                       /* cache the data for very long periods of time (perhaps not writing   */
+                       /* it to disk until Ardour closes). So let's force it to flush now.    */
+                       for (chn = 0; chn < channels; ++chn)
+                               if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(newfiles[chn])) != 0)
+                                       afs->flush ();
+#endif
                        break;
                }
 
@@ -464,7 +473,7 @@ remove_file_source (boost::shared_ptr<Source> source)
        boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (source);
 
        if (fs) {
-               ::unlink (fs->path().c_str());
+               ::g_unlink (fs->path().c_str());
        }
 }