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

Function get_extension_config

pysssss.py:67–90  ·  view source on GitHub ↗
(reload=False)

Source from the content-addressed store, hash-verified

65
66
67def get_extension_config(reload=False):
68 global config
69 if reload == False and config is not None:
70 return config
71
72 config_path = get_ext_dir("pysssss.json")
73 default_config_path = get_ext_dir("pysssss.default.json")
74 if not os.path.exists(config_path):
75 if os.path.exists(default_config_path):
76 shutil.copy(default_config_path, config_path)
77 if not os.path.exists(config_path):
78 log(f"Failed to create config at {config_path}", type="ERROR", always=True, name="???")
79 print(f"Extension path: {get_ext_dir()}")
80 return {"name": "Unknown", "version": -1}
81
82 else:
83 log("Missing pysssss.default.json, this extension may not work correctly. Please reinstall the extension.",
84 type="ERROR", always=True, name="???")
85 print(f"Extension path: {get_ext_dir()}")
86 return {"name": "Unknown", "version": -1}
87
88 with open(config_path, "r") as f:
89 config = json.loads(f.read())
90 return config
91
92
93def link_js(src, dst):

Callers 4

is_logging_enabledFunction · 0.85
logFunction · 0.85
get_web_ext_dirFunction · 0.85
get_config_valueFunction · 0.85

Calls 3

get_ext_dirFunction · 0.85
logFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected