Skip to content

Commit b3c8813

Browse files
committed
Fix a bug with core_dir on Windows when it exists in the root of drive
1 parent 4caca64 commit b3c8813

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pioinstaller/core.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ def get_core_dir():
3939
return core_dir
4040

4141
win_core_dir = os.path.splitdrive(core_dir)[0] + "\\.platformio"
42-
if not os.path.isdir(win_core_dir):
43-
try:
44-
os.makedirs(win_core_dir)
45-
with open(os.path.join(win_core_dir, "file.tmp"), "w") as fp:
46-
fp.write("test")
47-
os.remove(os.path.join(win_core_dir, "file.tmp"))
48-
return win_core_dir
49-
except: # pylint:disable=bare-except
50-
pass
42+
if os.path.isdir(win_core_dir):
43+
return win_core_dir
44+
try:
45+
os.makedirs(win_core_dir)
46+
with open(os.path.join(win_core_dir, "file.tmp"), "w") as fp:
47+
fp.write("test")
48+
os.remove(os.path.join(win_core_dir, "file.tmp"))
49+
return win_core_dir
50+
except: # pylint:disable=bare-except
51+
pass
5152

5253
return core_dir
5354

0 commit comments

Comments
 (0)