This commit is contained in:
yumoqing 2025-09-04 17:47:29 +08:00
parent 50a6e518f6
commit 9abd55da57

View File

@ -142,18 +142,7 @@ def _mkdir(newdir) :
- regular file in the way, raise an exception - regular file in the way, raise an exception
- parent directory(ies) does not exist, make them as well - parent directory(ies) does not exist, make them as well
""" """
if os.path.isdir(newdir): return os.makedirs(newdir, exist_ok=True)
pass
elif os.path.isfile(newdir):
raise OSError("a file with the same name as the desired " \
"dir, '%s', already exists." % newdir)
else:
head, tail = os.path.split(newdir)
if head and not os.path.isdir(head):
_mkdir(head)
#print "_mkdir %s" % repr(newdir)
if tail:
os.mkdir(newdir)
def _copyfile(fp,dir) : def _copyfile(fp,dir) :
fs = open(fp,'rb') fs = open(fp,'rb')