X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fstring_text_file.cc;h=b8ca27e160ca989ad283768f963a1bdf974546db;hp=8c2c5651854e08a625f2d9602bfc9aaede91cf43;hb=8a8c977c12fc65f1f50ea05099387e0fc8840e7d;hpb=efe153ab23b54cdbf28c653f2ccb0f25ca6bd015 diff --git a/src/lib/string_text_file.cc b/src/lib/string_text_file.cc index 8c2c56518..b8ca27e16 100644 --- a/src/lib/string_text_file.cc +++ b/src/lib/string_text_file.cc @@ -18,29 +18,33 @@ */ -#include "string_text_file.h" + #include "cross.h" #include "exceptions.h" +#include "string_text_file.h" #include "string_text_file_content.h" -#include +#include +#include #include #include -#include +#include #include #include #include #include "i18n.h" -using std::vector; + using std::cout; -using std::string; using std::shared_ptr; +using std::string; +using std::vector; using boost::scoped_array; using boost::optional; using dcp::ArrayData; using namespace dcpomatic; + StringTextFile::StringTextFile (shared_ptr content) { string ext = content->path(0).extension().string(); @@ -49,17 +53,15 @@ StringTextFile::StringTextFile (shared_ptr content) std::unique_ptr reader; if (ext == ".stl") { - auto f = fopen_boost (content->path(0), "rb"); + dcp::File f(content->path(0), "rb"); if (!f) { - throw OpenFileError (content->path(0), errno, OpenFileError::READ); + throw OpenFileError (f.path(), errno, OpenFileError::READ); } try { - reader.reset(new sub::STLBinaryReader(f)); + reader.reset(new sub::STLBinaryReader(f.get())); } catch (...) { - fclose (f); throw; } - fclose (f); } else { /* Text-based file; sort out its character encoding before we try to parse it */