MCPcopy
hub / github.com/pythongosssss/ComfyUI-Custom-Scripts / get_file

Function get_file

py/text_files.py:61–78  ·  view source on GitHub ↗
(root_dir, file)

Source from the content-addressed store, hash-verified

59
60
61def get_file(root_dir, file):
62 if file == "[none]" or not file or not file.strip():
63 raise ValueError("No file")
64
65 root_dir = get_dir_from_name(root_dir)
66 root_dir = get_real_path(root_dir)
67 if not os.path.exists(root_dir):
68 os.mkdir(root_dir)
69 full_path = os.path.join(root_dir, file)
70
71 file_dir = os.path.dirname(full_path)
72 if file_dir and not os.path.exists(file_dir):
73 os.makedirs(file_dir, exist_ok=True)
74
75 if not is_child_dir(root_dir, full_path):
76 raise ReferenceError()
77
78 return full_path
79
80
81class TextFileNode:

Callers 3

VALIDATE_INPUTSMethod · 0.85
load_textMethod · 0.85
write_textMethod · 0.85

Calls 3

get_dir_from_nameFunction · 0.85
get_real_pathFunction · 0.85
is_child_dirFunction · 0.85

Tested by

no test coverage detected