(reload=False)
| 65 | |
| 66 | |
| 67 | def 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 | |
| 93 | def link_js(src, dst): |
no test coverage detected