summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-09-10 13:17:53 -0700
committerOri Bernstein <ori@eigenstate.org>2017-09-10 13:17:53 -0700
commitc3b5d8f485e8d981d12d7c59386f39125cb3a864 (patch)
treef29e4cf07d97f1e7c1e5a8ac3cc9cf2379a549cb /lib
parent2551a75889ee7eee8d9cb222c9d4f3111fccfa85 (diff)
downloadmc-c3b5d8f485e8d981d12d7c59386f39125cb3a864.tar.gz
Add fexists check before mkdir.
More reliable on more systems than just mkdir.
Diffstat (limited to 'lib')
-rw-r--r--lib/std/mkpath.myr8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/std/mkpath.myr b/lib/std/mkpath.myr
index 61e2a72..22d1d3d 100644
--- a/lib/std/mkpath.myr
+++ b/lib/std/mkpath.myr
@@ -10,9 +10,11 @@ const mkpath = {p
for var i = 0; i < p.len; i++
if p[i] == ('/' : byte) && i != 0
- st = mkdir(p[:i], 0o755)
- if st != 0 && st != Eexist
- -> st
+ if !fexists(p[:i])
+ st = mkdir(p[:i], 0o755)
+ if st != 0
+ -> st
+ ;;
;;
;;
;;