# HG changeset patch # User Oleg Oshmyan # Date 1307147515 -3600 # Node ID 2db236d25ecdba303cb41b16a5ef7eab275d6073 # Parent f8041e1e4d0d1ae0f866c81fb24fb209fd1d13fe Improved the nativization of absolute paths by config.nativize_path diff -r f8041e1e4d0d -r 2db236d25ecd upreckon/config.py --- a/upreckon/config.py Sat Jun 04 00:14:16 2011 +0100 +++ b/upreckon/config.py Sat Jun 04 01:31:55 2011 +0100 @@ -92,10 +92,16 @@ elif comp == '.': comps[i] = os.path.curdir native_path = os.path.join(*comps) - if posixpath.isabs(portable_path) != os.path.isabs(native_path): + if posixpath.isabs(portable_path) and not os.path.isabs(native_path): + abspath = os.path.abspath(native_path) + parent = os.path.dirname(abspath) + while parent != abspath: + abspath, parent = parent, os.path.dirname(parent) + native_path = os.path.join(parent, native_path) + elif not posixpath.isabs(portable_path) and os.path.isabs(native_path): native_path = os.path.sep + native_path - if posixpath.isabs(portable_path) != os.path.isabs(native_path): - raise ValueError('cannot make native path relative/absolute') + if posixpath.isabs(portable_path) != os.path.isabs(native_path): + raise ValueError('cannot make native path relative/absolute') return native_path def load_problem(problem_name):