X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fconfig.cc;h=3661d8ba58268b85d0d606ea6e1b8123b19e449b;hp=b46093726bed345c25b649209b2af8f580796e47;hb=8a8c977c12fc65f1f50ea05099387e0fc8840e7d;hpb=efe153ab23b54cdbf28c653f2ccb0f25ca6bd015 diff --git a/src/lib/config.cc b/src/lib/config.cc index b46093726..3661d8ba5 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -1031,12 +1031,12 @@ Config::write_config () const try { auto const s = doc.write_to_string_formatted (); boost::filesystem::path tmp (string(target.string()).append(".tmp")); - auto f = fopen_boost (tmp, "w"); + dcp::File f(tmp, "w"); if (!f) { throw FileError (_("Could not open file for writing"), tmp); } - checked_fwrite (s.c_str(), s.bytes(), f, tmp); - fclose (f); + f.checked_write(s.c_str(), s.bytes()); + f.close(); boost::filesystem::remove (target); boost::filesystem::rename (tmp, target); } catch (xmlpp::exception& e) { @@ -1416,13 +1416,8 @@ Config::copy_and_link (boost::filesystem::path new_file) const bool Config::have_write_permission () const { - auto f = fopen_boost (config_write_file(), "r+"); - if (!f) { - return false; - } - - fclose (f); - return true; + dcp::File f(config_write_file(), "r+"); + return static_cast(f); } /** @param output_channels Number of output channels in use.