def format_file_path(file_path): # format slashes properly for a file path file_path = file_path.strip() file_path = trim(file_path, '/', left_most=1, right_most=1) # add wildcard asterisk if path points to directory if file_path.endswith('/'): file_path += '*' return file_path
def format_dir_path(dir_path): # format slashes properly for a dir path dir_path = dir_path.strip() if dir_path == '': return dir_path return trim(dir_path, '/', left_most=1, right=1)