diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index dc6c1dd2fb..98f5e3c4be 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -67,7 +67,7 @@ def pretty_filename(filename): try: a = os.path.abspath(filename) r = os.path.relpath(filename) - return a if len(a) < len(r) else r + return a if '..' in r else r except ValueError: return filename diff --git a/pyuavcan/pyuavcan/dsdl/common.py b/pyuavcan/pyuavcan/dsdl/common.py index 216cce6b1b..4cbeb61577 100644 --- a/pyuavcan/pyuavcan/dsdl/common.py +++ b/pyuavcan/pyuavcan/dsdl/common.py @@ -30,4 +30,4 @@ def pretty_filename(filename): '''Returns a nice human readable path to 'filename'.''' a = os.path.abspath(filename) r = os.path.relpath(filename) - return a if len(a) < len(r) else r + return a if '..' in r else r