From 5bfa1999f41e4983a947efa0029efd2de6873beb Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sun, 24 Aug 2014 15:33:43 +0400 Subject: [PATCH] dsdlc/pyuavcan: nicer path formatting --- libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py | 2 +- pyuavcan/pyuavcan/dsdl/common.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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