Don't print relative paths with double-dot

This commit is contained in:
Valerii Koval
2020-06-18 20:36:59 +03:00
parent 260c36727c
commit c20a1f24cd

View File

@ -33,7 +33,11 @@ def PioClean(env, clean_dir):
def _relpath(path):
if compat.WINDOWS:
prefix = os.getcwd()[:2].lower()
if ":" not in prefix or not path.lower().startswith(prefix):
if (
":" not in prefix
or not path.lower().startswith(prefix)
or os.path.relpath(path).startswith("..")
):
return path
return os.path.relpath(path)