Add a warning message about Windows controlled folder access.
[dcpomatic.git] / src / tools / dcpomatic.cc
index 3fb291fc427d3d0647e9f9b13fd940cd604b6d9d..26b4946b5ed6250a298a557e1d30d9bd27e0ac86 100644 (file)
@@ -505,7 +505,7 @@ private:
                        } catch (boost::filesystem::filesystem_error& e) {
 #ifdef DCPOMATIC_WINDOWS
                                string bad_chars = "<>:\"/|?*";
-                               string const filename = d->path().string();
+                               string const filename = d->path().filename().string();
                                string found_bad_chars;
                                for (size_t i = 0; i < bad_chars.length(); ++i) {
                                        if (filename.find(bad_chars[i]) != string::npos && found_bad_chars.find(bad_chars[i]) == string::npos) {
@@ -513,9 +513,11 @@ private:
                                        }
                                }
                                wxString message = _("Could not create folder to store film.");
+                               message += "  ";
                                if (!found_bad_chars.empty()) {
-                                       message += "  ";
                                        message += wxString::Format (_("Try removing the %s characters from your folder name."), std_to_wx(found_bad_chars).data());
+                               } else {
+                                       message += _("Please check that you do not have Windows controlled folder access enabled for DCP-o-matic.");
                                }
                                error_dialog (this, message, std_to_wx(e.what()));
 #else
@@ -1455,20 +1457,20 @@ public:
        App ()
                : wxApp ()
                , _frame (0)
+               , _splash (0)
        {}
 
 private:
 
        bool OnInit ()
        {
-               wxSplashScreen* splash = 0;
                try {
                        wxInitAllImageHandlers ();
 
                        Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
                        Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
 
-                       splash = maybe_show_splash ();
+                       _splash = maybe_show_splash ();
 
                        SetAppName (_("DCP-o-matic"));
 
@@ -1511,9 +1513,9 @@ private:
                        _frame = new DOMFrame (_("DCP-o-matic"));
                        SetTopWindow (_frame);
                        _frame->Maximize ();
-                       if (splash) {
-                               splash->Destroy ();
-                               splash = 0;
+                       if (_splash) {
+                               _splash->Destroy ();
+                               _splash = 0;
                        }
 
                        if (!Config::instance()->nagged(Config::NAG_INITIAL_SETUP)) {
@@ -1546,7 +1548,7 @@ private:
                        }
 
                        signal_manager = new wxSignalManager (this);
-                       Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
+                       Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1));
 
                        Bind (wxEVT_TIMER, boost::bind (&App::check, this));
                        _timer.reset (new wxTimer (this));
@@ -1558,8 +1560,8 @@ private:
                }
                catch (exception& e)
                {
-                       if (splash) {
-                               splash->Destroy ();
+                       if (_splash) {
+                               _splash->Destroy ();
                        }
                        error_dialog (0, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
                }
@@ -1598,6 +1600,11 @@ private:
 
        void report_exception ()
        {
+               if (_splash) {
+                       _splash->Destroy ();
+                       _splash = 0;
+               }
+
                try {
                        throw;
                } catch (FileError& e) {
@@ -1635,9 +1642,10 @@ private:
                report_exception ();
        }
 
-       void idle ()
+       void idle (wxIdleEvent& ev)
        {
                signal_manager->ui_idle ();
+               ev.Skip ();
        }
 
        void check ()
@@ -1665,6 +1673,11 @@ private:
                        return false;
                }
 
+               if (_splash) {
+                       _splash->Destroy ();
+                       _splash = 0;
+               }
+
                RecreateChainDialog* d = new RecreateChainDialog (_frame);
                int const r = d->ShowModal ();
                d->Destroy ();
@@ -1672,6 +1685,7 @@ private:
        }
 
        DOMFrame* _frame;
+       wxSplashScreen* _splash;
        shared_ptr<wxTimer> _timer;
        string _film_to_load;
        string _film_to_create;