Move common, path-related functions, to util.py