diff --git a/css_utils.py b/css_utils.py index b9cfb21..42902cb 100644 --- a/css_utils.py +++ b/css_utils.py @@ -126,7 +126,7 @@ def store_path() -> str: return os.path.join(get_theme_path(), "STORE") def get_mappings_folder_path() -> str: - path = os.path.join(get_theme_path(), "__mappings") + path = os.path.join(get_theme_path(), "__mappings") if not os.path.exists(path): create_dir(path) @@ -166,18 +166,6 @@ def store_write(key : str, val : str): with open(path, 'w') as fp: fp.write("\n".join([f"{x}:{items[x]}" for x in items])) -def save_mappings(val: str, version: str): - is_beta = is_steam_beta_active() - branch_str = "beta" if is_beta else "stable" - path = get_mappings_folder_path() - - if not os.exists(path): - create_dir(path) - - file_location = os.path.join(path, f"{version}.{branch_str}.json") - with open(file_location, 'w') as fp: - fp.write(val) - def get_steam_version() -> None|str: path = os.path.join(get_steam_path(), "logs", "console_log.txt") @@ -192,4 +180,13 @@ def get_steam_version() -> None|str: if version != None and len(version) > 0: return version - return None \ No newline at end of file + return None + +def save_mappings(val: str): + is_beta = is_steam_beta_active() + branch_str = "beta" if is_beta else "stable" + path = get_mappings_folder_path() + + file_location = os.path.join(path, f"{get_steam_version()}.{branch_str}.json") + with open(file_location, 'w', encoding="utf-8") as fp: + fp.write(val) \ No newline at end of file diff --git a/main.py b/main.py index 38e55c5..06897a0 100644 --- a/main.py +++ b/main.py @@ -135,8 +135,8 @@ async def store_write(self, key : str, val : str) -> dict: util_store_write(key, val) return Result(True).to_dict() - async def save_mappings(self, val: str, version: str) -> dict: - util_save_mappings(val, version) + async def save_mappings(self, val: str) -> dict: + util_save_mappings(val) return Result(True).to_dict() async def get_webpack_mappigns(self) -> dict: diff --git a/src/deckyPatches/dump-mappings.ts b/src/deckyPatches/dump-mappings.ts index 3cdd291..8a76b63 100644 --- a/src/deckyPatches/dump-mappings.ts +++ b/src/deckyPatches/dump-mappings.ts @@ -7,10 +7,7 @@ export async function dumpMappings() { if (!map) return; const jsonStr = JSON.stringify(Object.fromEntries(map)); - const steamInfo = await SteamClient.System.GetSystemInfo(); - const version = String(steamInfo.nSteamVersion); - - await saveMappings(jsonStr, version); + await saveMappings(jsonStr); } catch (error) { console.error("ERROR SAVING MAPPINGS", error); } diff --git a/src/python.ts b/src/python.ts index 96a7d37..3637cfe 100644 --- a/src/python.ts +++ b/src/python.ts @@ -273,6 +273,6 @@ export function generatePresetFromThemeNames(name: string, themeNames: string[]) }); } -export function saveMappings(val: string, version: string) { - return server!.callPluginMethod("save_mappings", { val: val, version: version }); +export function saveMappings(val: string) { + return server!.callPluginMethod("save_mappings", { val: val }); }