diff options
Diffstat (limited to 'libqpdf/QUtil.cc')
-rw-r--r-- | libqpdf/QUtil.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index f45468a0..daa663a3 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -515,6 +515,21 @@ QUtil::fopen_wrapper(std::string const& description, FILE* f) return f; } +bool +QUtil::file_can_be_opened(char const* filename) +{ + try + { + fclose(safe_fopen(filename, "rb")); + return true; + } + catch (std::runtime_error&) + { + // can't open the file + } + return false; +} + int QUtil::seek(FILE* stream, qpdf_offset_t offset, int whence) { |