shithub: mc

Download patch

ref: c3b5d8f485e8d981d12d7c59386f39125cb3a864
parent: 2551a75889ee7eee8d9cb222c9d4f3111fccfa85
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Sep 10 09:17:53 EDT 2017

Add fexists check before mkdir.

	More reliable on more systems than just mkdir.

--- a/lib/std/mkpath.myr
+++ b/lib/std/mkpath.myr
@@ -10,9 +10,11 @@
 
 	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
+				;;
 			;;
 		;;
 	;;