Make sure we don't create any config directories until we've set up the i18n properly.
authorCarl Hetherington <cth@carlh.net>
Thu, 27 Aug 2015 12:45:46 +0000 (13:45 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 27 Aug 2015 12:45:46 +0000 (13:45 +0100)
ChangeLog
src/lib/config.cc
src/lib/config.h

index 6af9eb3c97257242dfaaa06c9954207a39708f35..f043d95b3ba4cc421af3c47594cbc926c4d7998f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-27  Carl Hetherington  <cth@carlh.net>
+
+       * Fix creation of badly-named configuration
+       directories in some circumstances (#654).
+
 2015-08-26  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.1.46 released.
index cec054aaaece0d304b6e4f5bda99a5fd0277fd7f..4995793e9ce8304e97cfcd43ece53387463dd925 100644 (file)
@@ -269,7 +269,7 @@ Config::read ()
 
 /** @return Filename to write configuration to */
 boost::filesystem::path
-Config::file ()
+Config::file (bool create_directories)
 {
        boost::filesystem::path p;
 #ifdef DCPOMATIC_OSX
@@ -283,7 +283,9 @@ Config::file ()
        p /= "dcpomatic2";
 #endif
        boost::system::error_code ec;
-       boost::filesystem::create_directories (p, ec);
+       if (create_directories) {
+               boost::filesystem::create_directories (p, ec);
+       }
        p /= "config.xml";
        return p;
 }
@@ -468,5 +470,5 @@ Config::add_to_history (boost::filesystem::path p)
 bool
 Config::have_existing ()
 {
-       return boost::filesystem::exists (file ());
+       return boost::filesystem::exists (file (false));
 }
index 9d583ff6dbd39d46ea7f22dc00d39808b9a614ff..fc63c518cd944b71aaca336c5c1f1944702dace2 100644 (file)
@@ -432,7 +432,7 @@ public:
 
 private:
        Config ();
-       static boost::filesystem::path file ();
+       static boost::filesystem::path file (bool create_directories = true);
        void read ();
        void set_defaults ();
        void set_kdm_email_to_default ();