Allow opening sessions with files embedded from removable drives
authorRobin Gareus <robin@gareus.org>
Thu, 13 Oct 2016 00:07:08 +0000 (02:07 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 13 Oct 2016 00:07:34 +0000 (02:07 +0200)
Otherwise Windows shows a critical error for files embedded from
removable devices.

libs/ardour/session_state.cc

index ec98908a547c8d6aa22ab3f7c04bbf71b623f3d5..ba0474f741d1757fc1691bde04d332f70bdaf806 100644 (file)
@@ -2112,13 +2112,27 @@ Session::load_sources (const XMLNode& node)
        set_dirty();
 
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+#ifdef PLATFORM_WINDOWS
+               int old_mode = 0;
+#endif
+
           retry:
                try {
+#ifdef PLATFORM_WINDOWS
+                       // do not show "insert media" popups (files embedded from removable media).
+                       old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
+#endif
                        if ((source = XMLSourceFactory (**niter)) == 0) {
                                error << _("Session: cannot create Source from XML description.") << endmsg;
                        }
+#ifdef PLATFORM_WINDOWS
+                       SetErrorMode(old_mode);
+#endif
 
                } catch (MissingSource& err) {
+#ifdef PLATFORM_WINDOWS
+                       SetErrorMode(old_mode);
+#endif
 
                         int user_choice;