Skip to contentSkip to conversation

utils: Let makedirhier fail if existing path is not a folder

PATCH New andre.rosa 1 participant 1 message Apr 11, 2019 1 message not in the archive

lore
Share & tools
lore

andre.rosa

author
#1 lore raw

PATCH 1/1 utils: Let makedirhier fail if existing path is not a folder

In reply to a message not in the archive

From: Andre Rosa <[email protected]>

... instead of assuming a directory hierarchy is there or was created.

---
 lib/bb/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/utils.py +1 -1
@@ -734,7 +734,7 @@ def mkdirhier(directory):
     try:
         os.makedirs(directory)
     except OSError as e:
-        if e.errno != errno.EEXIST:
+        if e.errno != errno.EEXIST or not os.path.isdir(directory):
             raise e
 
 def movefile(src, dest, newmtime = None, sstat = None):

--
2.20.1.519.g8feddda32c