Skip to content

Commit 450aaca

Browse files
committed
Fix bug when working with network drives in windows.
1 parent b2d2a51 commit 450aaca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

advanced_new_file/anf_util.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@
7474
def generate_creation_path(settings, base, path, append_extension=False):
7575
if PLATFORM == "windows":
7676
if not re.match(WIN_ROOT_REGEX, base):
77-
return base + TOP_LEVEL_SPLIT_CHAR + path
77+
if IS_ST3:
78+
drive, _ = os.path.splitdrive(base)
79+
else:
80+
drive, _ = os.path.splitunc(base)
81+
if len(drive) == 0:
82+
return base + TOP_LEVEL_SPLIT_CHAR + path
83+
else:
84+
return os.path.join(base, path)
7885
else:
7986
if not re.match(NIX_ROOT_REGEX, base):
8087
return base + TOP_LEVEL_SPLIT_CHAR + path

0 commit comments

Comments
 (0)