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 * Updated "Teensy Loader CLI" and fixed uploading of large .hex files
(`issue #568 <https://github.com/platformio/platformio/issues/568>`_) (`issue #568 <https://github.com/platformio/platformio/issues/568>`_)
* Better handling of used boards when re-initialize/update project * 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 * Disabled progress bar for download operations when prompts are disabled
* Fixed multiple definition errors for ST STM32 development platform and mbed * Fixed multiple definition errors for ST STM32 development platform and mbed
framework framework

View File

@ -20,8 +20,10 @@ import re
import subprocess import subprocess
import sys import sys
from glob import glob 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 platform import system, uname
from tempfile import TemporaryFile
from threading import Thread from threading import Thread
from platformio import __apiip__, __apiurl__, __version__, exception from platformio import __apiip__, __apiurl__, __version__, exception
@ -161,7 +163,15 @@ def get_home_dir():
) )
if not isdir(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) assert isdir(home_dir)
return home_dir return home_dir