From b55dc0917deb79e42c6b48062fafe68988ca7f8d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 14 Feb 2015 16:34:00 +0200 Subject: [PATCH] Fix bug with deleting ".pioenvs" when it doesn't exist --- platformio/commands/run.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 0d8c6d27..9c7daf9d 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -from os.path import getmtime, join +from os.path import getmtime, isdir, join from shutil import rmtree import click @@ -28,9 +28,11 @@ def cli(ctx, environment, target, upload_port): raise exception.UnknownEnvNames(", ".join(unknown)) # remove ".pioenvs" if project config is modified - if (getmtime(join(util.get_project_dir(), "platformio.ini")) > - getmtime(util.get_pioenvs_dir())): - rmtree(util.get_pioenvs_dir()) + _pioenvs_dir = util.get_pioenvs_dir() + if (isdir(_pioenvs_dir) and + getmtime(join(util.get_project_dir(), "platformio.ini")) > + getmtime(_pioenvs_dir)): + rmtree(_pioenvs_dir) for section in config.sections(): # skip main configuration section