MCPcopy Index your code
hub / github.com/bugy/script-server / normalize_path

Function normalize_path

src/utils/file_utils.py:36–50  ·  view source on GitHub ↗
(path_string, current_folder=None)

Source from the content-addressed store, hash-verified

34
35
36def normalize_path(path_string, current_folder=None):
37 path_string = os.path.expanduser(path_string)
38 path_string = os.path.normpath(path_string)
39
40 if os.path.isabs(path_string):
41 return path_string
42
43 if current_folder:
44 normalized_folder = normalize_path(current_folder)
45 return os.path.join(normalized_folder, path_string)
46
47 if not os.path.exists(path_string):
48 return path_string
49
50 return str(pathlib.Path(path_string).resolve())
51
52
53def read_file(filename, byte_content=False, keep_newlines=False):

Callers 11

prepare_new_folderMethod · 0.90
read_fileFunction · 0.85
write_fileFunction · 0.85
prepare_folderFunction · 0.85
existsFunction · 0.85
relative_pathFunction · 0.85
_normalize_patternMethod · 0.85

Calls

no outgoing calls