From 64c24be408b70a6737f3aa8bde7fbbe8dce43290 Mon Sep 17 00:00:00 2001 From: Tommi Pisto Date: Tue, 14 Apr 2015 11:16:25 +0300 Subject: [PATCH] Changed the posix fileExists -> fopen call. --- package.json | 2 +- src/NodePoppler.cc | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index badd75f..7ffbc81 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "keywords": [ "pdf", "forms", "poppler", "qt4", "cairo" ], - "version": "0.1.2", + "version": "0.1.3", "repository": { "type": "git", "url": "git://github.com/tpisto/pdf-fill-form.git" diff --git a/src/NodePoppler.cc b/src/NodePoppler.cc index 5531a4a..41ae68e 100644 --- a/src/NodePoppler.cc +++ b/src/NodePoppler.cc @@ -27,7 +27,12 @@ using v8::Array; using v8::Value; inline bool fileExists (const std::string& name) { - return ( access( name.c_str(), F_OK ) != -1 ); + if (FILE *file = fopen(name.c_str(), "r")) { + fclose(file); + return true; + } else { + return false; + } } // Cairo write and read functions (to QBuffer)