aboutsummaryrefslogtreecommitdiff
path: root/butl/filesystem.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-10 15:33:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-10 15:33:45 +0200
commit80b4ee65c55c896f12109c338ba9aa386b5719c6 (patch)
treed374717f6603429d5f870c3d002ab0998626cf88 /butl/filesystem.cxx
parent49cd0e47d3783bcc31521a2425061ca7fae07363 (diff)
Implement try_mkdir_p()
Diffstat (limited to 'butl/filesystem.cxx')
-rw-r--r--butl/filesystem.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/butl/filesystem.cxx b/butl/filesystem.cxx
index 4cf60b2..c65d591 100644
--- a/butl/filesystem.cxx
+++ b/butl/filesystem.cxx
@@ -108,6 +108,20 @@ namespace butl
return r;
}
+ mkdir_status
+ try_mkdir_p (const path& p, mode_t m)
+ {
+ if (!p.root ())
+ {
+ path d (p.directory ());
+
+ if (!dir_exists (d))
+ try_mkdir_p (d, m);
+ }
+
+ return try_mkdir (p, m);
+ }
+
rmdir_status
try_rmdir (const path& p)
{