Improve support for non-Unicode user profiles for Windows OS

This commit is contained in:
Ivan Kravets
2016-03-21 18:08:15 +02:00
parent 657345fa7a
commit ea5a0ae75c
2 changed files with 13 additions and 2 deletions

View File

@ -15,6 +15,7 @@ PlatformIO 2.0
* Updated "Teensy Loader CLI" and fixed uploading of large .hex files
(`issue #568 <https://github.com/platformio/platformio/issues/568>`_)
* Better handling of used boards when re-initialize/update project
* Improved support for non-Unicode user profiles for Windows OS
* Disabled progress bar for download operations when prompts are disabled
* Fixed multiple definition errors for ST STM32 development platform and mbed
framework

View File

@ -20,8 +20,10 @@ import re
import subprocess
import sys
from glob import glob
from os.path import abspath, basename, dirname, expanduser, isdir, isfile, join
from os.path import (abspath, basename, dirname, expanduser, isdir, isfile,
join, splitdrive)
from platform import system, uname
from tempfile import TemporaryFile
from threading import Thread
from platformio import __apiip__, __apiurl__, __version__, exception
@ -161,7 +163,15 @@ def get_home_dir():
)
if not isdir(home_dir):
os.makedirs(home_dir)
try:
os.makedirs(home_dir)
f = TemporaryFile(dir=home_dir)
f.close()
except (OSError, WindowsError):
if "windows" in get_systype():
home_dir = splitdrive(home_dir)[0] + "\.platformio"
if not isdir(home_dir):
os.makedirs(home_dir)
assert isdir(home_dir)
return home_dir