aboutsummaryrefslogtreecommitdiff
path: root/libbutl/filesystem.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-22 14:15:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-22 14:15:35 +0200
commit374db6aebec2a008538c7708305b9be01000c013 (patch)
treead62a79260958ca9bcad5e13be964c02363a84c3 /libbutl/filesystem.hxx
parent001d98f94f6d97a79abe78bc909c263f9e74c527 (diff)
Add touch_file() filesystem function
Diffstat (limited to 'libbutl/filesystem.hxx')
-rw-r--r--libbutl/filesystem.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/libbutl/filesystem.hxx b/libbutl/filesystem.hxx
index 9bf6f0c..ef1b22b 100644
--- a/libbutl/filesystem.hxx
+++ b/libbutl/filesystem.hxx
@@ -104,6 +104,14 @@ namespace butl
bool
file_empty (const path&);
+ // Set the file access and modification times to the current time. If the
+ // file does not exist and create is true, create it and fail otherwise.
+ // Return true if the file was created and false otherwise. Errors are
+ // reported by throwing std::system_error.
+ //
+ LIBBUTL_SYMEXPORT bool
+ touch_file (const path&, bool create = true);
+
// Try to create a directory unless it already exists. If you expect
// the directory to exist and performance is important, then you
// should first call dir_exists() above since that's what this