summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/file.cc9
-rw-r--r--src/file.h9
2 files changed, 18 insertions, 0 deletions
diff --git a/src/file.cc b/src/file.cc
index 8759c7c1..f7c865b2 100644
--- a/src/file.cc
+++ b/src/file.cc
@@ -134,6 +134,15 @@ File::checked_read(void* ptr, size_t size)
}
+FILE*
+File::take()
+{
+ auto give = _file;
+ _file = nullptr;
+ return give;
+}
+
+
/** Windows can't "by default" cope with paths longer than 260 characters, so if you pass such a path to
* any boost::filesystem method it will fail. There is a "fix" for this, which is to prepend
* the string \\?\ to the path. This will make it work, so long as:
diff --git a/src/file.h b/src/file.h
index e0564cae..7dae44a6 100644
--- a/src/file.h
+++ b/src/file.h
@@ -72,6 +72,15 @@ public:
*/
void close();
+ boost::filesystem::path path() const {
+ return _path;
+ }
+
+ /** Take ownership of the underlying FILE*;
+ * the File object will not closed it after this call.
+ */
+ FILE* take();
+
private:
boost::filesystem::path _path;
FILE* _file = nullptr;