aboutsummaryrefslogtreecommitdiff
path: root/build/filesystem
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-25 14:48:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-25 14:48:36 +0200
commitcd75e06a87aa74aa6968113107afa53d401d20bc (patch)
tree1e104829d10f375a783d6efbbf7eef3e2c6d2ef5 /build/filesystem
parenta94dcda7f00b10cb22b5f2138b1c29bcfbe7de37 (diff)
Configure/disfigure src_root saving/removing support; fsdir{} injection
We can now build out-of-tree.
Diffstat (limited to 'build/filesystem')
-rw-r--r--build/filesystem20
1 files changed, 14 insertions, 6 deletions
diff --git a/build/filesystem b/build/filesystem
index c96e669..8617dd4 100644
--- a/build/filesystem
+++ b/build/filesystem
@@ -23,13 +23,21 @@ namespace build
bool
file_exists (const path&);
-
- // Note that you should probably use the default mode 0777 and let
- // the umask mechanism adjust it to the user's preferences. Errors
- // are reported by throwing std::system_error.
+ // 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
+ // implementation will do to make sure the path is actually a
+ // directory.
+ //
+ // You should also probably use the default mode 0777 and let the
+ // umask mechanism adjust it to the user's preferences.
//
- void
- mkdir (const path&, mode_t = 0777);
+ // Errors are reported by throwing std::system_error.
+ //
+ enum class mkdir_status {success, already_exists};
+
+ mkdir_status
+ try_mkdir (const path&, mode_t = 0777);
// Try to remove the directory returning not_exist if it does not
// exist and not_empty if it is not empty. All other errors are