Skip to content

Commit 727e820

Browse files
committed
Fix a bug with core_dir on Windows when it exists in the root of drive
1 parent 209ab83 commit 727e820

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pioinstaller/core.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ def get_core_dir():
3535
return os.getenv("PLATFORMIO_CORE_DIR")
3636

3737
core_dir = os.path.join(util.expanduser("~"), ".platformio")
38-
if not util.IS_WINDOWS or not util.has_non_ascii_char(core_dir):
38+
if not util.IS_WINDOWS:
3939
return core_dir
4040

4141
win_core_dir = os.path.splitdrive(core_dir)[0] + "\\.platformio"
4242
if os.path.isdir(win_core_dir):
4343
return win_core_dir
4444
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
45+
if util.has_non_ascii_char(core_dir):
46+
os.makedirs(win_core_dir)
47+
with open(os.path.join(win_core_dir, "file.tmp"), "w") as fp:
48+
fp.write("test")
49+
os.remove(os.path.join(win_core_dir, "file.tmp"))
50+
return win_core_dir
5051
except: # pylint:disable=bare-except
5152
pass
5253

0 commit comments

Comments
 (0)