when mkdir of missing app folders, handle broken links properly

This commit is contained in:
sean committed 2016-12-01 10:29:23 -05:00
1 parent 0b8ecea4dc
commit 52fe4407b8
1 file changed
+4
+4
View File
@@ -438,6 +438,10 @@ def add_path_first(path):
def try_mkdir(path): def try_mkdir(path):
if not os.path.exists(path): if not os.path.exists(path):
try: try:
if os.path.islink(path):
# path is a broken link, try to mkdir the target of the link instead of the link itself.
os.mkdir(os.path.realpath(path))
else:
os.mkdir(path) os.mkdir(path)
except OSError as e: except OSError as e:
if e.strerror == 'File exists': # In case of race condition. if e.strerror == 'File exists': # In case of race condition.