Disable preferences menu if the config can't be written.
[dcpomatic.git] / src / lib / config.cc
index d7fd74449e4ab59430cd68793b832b5f29ddcfd4..e1d5b958d1af3da9413247aabd4ab4fe4412b0a2 100644 (file)
@@ -1201,3 +1201,15 @@ Config::copy_and_link (boost::filesystem::path new_file) const
        boost::filesystem::copy_file (config_file(), new_file, boost::filesystem::copy_option::overwrite_if_exists);
        link (new_file);
 }
+
+bool
+Config::have_write_permission () const
+{
+       FILE* f = fopen_boost (config_file(), "r+");
+       if (!f) {
+               return false;
+       }
+
+       fclose (f);
+       return true;
+}