forked from platformio/platformio-core
Handle WindowsError when can't create .pioenvs directory
This commit is contained in:
@@ -63,7 +63,7 @@ def cli(ctx, # pylint: disable=R0913,R0914
|
|||||||
click.secho(
|
click.secho(
|
||||||
"Can not remove temporary directory `%s`. Please remove "
|
"Can not remove temporary directory `%s`. Please remove "
|
||||||
"`.pioenvs` directory from the project manually to avoid "
|
"`.pioenvs` directory from the project manually to avoid "
|
||||||
"build issues" % util.get_projectpioenvs_dir(),
|
"build issues" % util.get_projectpioenvs_dir(force=True),
|
||||||
fg="yellow")
|
fg="yellow")
|
||||||
|
|
||||||
config = util.load_project_config()
|
config = util.load_project_config()
|
||||||
|
@@ -218,18 +218,22 @@ def get_projecttest_dir():
|
|||||||
"test"))
|
"test"))
|
||||||
|
|
||||||
|
|
||||||
def get_projectpioenvs_dir():
|
def get_projectpioenvs_dir(force=False):
|
||||||
path = _get_projconf_option_dir("envs_dir",
|
path = _get_projconf_option_dir("envs_dir",
|
||||||
join(get_project_dir(), ".pioenvs"))
|
join(get_project_dir(), ".pioenvs"))
|
||||||
if not isdir(path):
|
try:
|
||||||
os.makedirs(path)
|
if not isdir(path):
|
||||||
dontmod_path = join(path, "do-not-modify-files-here.url")
|
os.makedirs(path)
|
||||||
if not isfile(dontmod_path):
|
dontmod_path = join(path, "do-not-modify-files-here.url")
|
||||||
with open(dontmod_path, "w") as fp:
|
if not isfile(dontmod_path):
|
||||||
fp.write("""
|
with open(dontmod_path, "w") as fp:
|
||||||
|
fp.write("""
|
||||||
[InternetShortcut]
|
[InternetShortcut]
|
||||||
URL=http://docs.platformio.org/en/stable/projectconf.html#envs-dir
|
URL=http://docs.platformio.org/en/stable/projectconf.html#envs-dir
|
||||||
""")
|
""")
|
||||||
|
except Exception as e:
|
||||||
|
if not force:
|
||||||
|
raise Exception(e)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user