def _load_idedata(config): platformio_ini = Path(CORE.relative_build_path("platformio.ini")) temp_idedata = Path(CORE.relative_internal_path("idedata", f"{CORE.name}.json")) changed = False if not platformio_ini.is_file() or not temp_idedata.is_file(): changed = True elif platformio_ini.stat().st_mtime >= temp_idedata.stat().st_mtime: changed = True if not changed: try: return json.loads(temp_idedata.read_text(encoding="utf-8")) except ValueError: pass temp_idedata.parent.mkdir(exist_ok=True, parents=True) data = _run_idedata(config) temp_idedata.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8") return data
def storage_path(): # type: () -> str return CORE.relative_internal_path(f"{CORE.config_filename}.json")