diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 12 | ||||
| -rw-r--r-- | src/lib/config.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index d7fd74449..e1d5b958d 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -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; +} diff --git a/src/lib/config.h b/src/lib/config.h index bcc46f8fa..80bb48d32 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -1002,6 +1002,7 @@ public: void write_cinemas () const; void link (boost::filesystem::path new_file) const; void copy_and_link (boost::filesystem::path new_file) const; + bool have_write_permission () const; void save_template (boost::shared_ptr<const Film> film, std::string name) const; bool existing_template (std::string name) const; |
