Fix Windows Error 32 while cleanup pioenvs dir

This commit is contained in:
Ivan Kravets
2015-06-05 19:12:57 +03:00
parent fa339a8b70
commit 35ae470196
2 changed files with 9 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
VERSION = (2, 1, "1.dev0")
VERSION = (2, 1, "1.dev1")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -181,19 +181,17 @@ def _clean_pioenvs_dir():
proj_hash = calculate_project_hash()
# if project's config is modified
if isdir(pioenvs_dir):
if (getmtime(join(util.get_project_dir(), "platformio.ini")) >
getmtime(pioenvs_dir)):
if (isdir(pioenvs_dir) and
getmtime(join(util.get_project_dir(), "platformio.ini")) >
getmtime(pioenvs_dir)):
rmtree(pioenvs_dir)
# check project structure
if isdir(pioenvs_dir):
if isfile(structhash_file):
with open(structhash_file) as f:
if f.read() == proj_hash:
return
else:
rmtree(pioenvs_dir)
if isdir(pioenvs_dir) and isfile(structhash_file):
with open(structhash_file) as f:
if f.read() == proj_hash:
return
rmtree(pioenvs_dir)
if not isdir(pioenvs_dir):
makedirs(pioenvs_dir)