Remove duplicate code in paths.sh