Create film directory in constructor.
authorCarl Hetherington <cth@carlh.net>
Sun, 7 Oct 2012 21:30:35 +0000 (22:30 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 7 Oct 2012 21:30:35 +0000 (22:30 +0100)
src/lib/film.cc

index 2db03f6a655b1a87c636cfcc9d296640f81a747a..20edacf59160cb704395a39fd3f89e08d35ad291 100644 (file)
@@ -85,8 +85,12 @@ Film::Film (string d, bool must_exist)
 
        _state.directory = result.string ();
        
-       if (must_exist && !filesystem::exists (_state.directory)) {
-               throw OpenFileError (_state.directory);
+       if (!filesystem::exists (_state.directory)) {
+               if (must_exist) {
+                       throw OpenFileError (_state.directory);
+               } else {
+                       filesystem::create_directory (_state.directory);
+               }
        }
 
        read_metadata ();