diff options
Diffstat (limited to 'build/filesystem')
-rw-r--r-- | build/filesystem | 20 |
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 |