diff options
| author | Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> | 2025-07-30 12:55:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-30 12:55:00 -0700 |
| commit | da9c3c8ec04933e921cce0929734a096b7e544fc (patch) | |
| tree | 808580ac03d3a2815055b4ed219562e7affd16df /py_modules/lsfg_vk/installation.py | |
| parent | b04fa027f7291710359bb6c4a8c1d0ebb85d53e5 (diff) | |
| parent | e8dc90a60ff4d9da00397dd8dbdff72bae0e9359 (diff) | |
| download | decky-lsfg-vk-da9c3c8ec04933e921cce0929734a096b7e544fc.tar.gz decky-lsfg-vk-da9c3c8ec04933e921cce0929734a096b7e544fc.zip | |
Merge pull request #102 from xXJSONDeruloXx/lsfg-vk-9.0-upstream
initial test to build on noui package based on upstream build of lsfg…
Diffstat (limited to 'py_modules/lsfg_vk/installation.py')
| -rw-r--r-- | py_modules/lsfg_vk/installation.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py index 996a03f..b0e05ad 100644 --- a/py_modules/lsfg_vk/installation.py +++ b/py_modules/lsfg_vk/installation.py @@ -6,6 +6,7 @@ import os import shutil import zipfile import tempfile +import json from pathlib import Path from typing import Dict, Any @@ -102,9 +103,43 @@ class InstallationService(BaseService): dst_dir = dest_map.get(file_path.suffix) if dst_dir: dst_file = dst_dir / file - shutil.copy2(src_file, dst_file) + + # Special handling for JSON files - need to modify library_path + if file_path.suffix == JSON_EXT and file == JSON_FILENAME: + self._copy_and_fix_json_file(src_file, dst_file) + else: + shutil.copy2(src_file, dst_file) + self.log.info(f"Copied {file} to {dst_file}") + def _copy_and_fix_json_file(self, src_file: Path, dst_file: Path) -> None: + """Copy JSON file and fix the library_path to use relative path + + Args: + src_file: Source JSON file path + dst_file: Destination JSON file path + """ + try: + # Read the JSON file + with open(src_file, 'r') as f: + json_data = json.load(f) + + # Fix the library_path from "liblsfg-vk.so" to "../../../lib/liblsfg-vk.so" + if 'layer' in json_data and 'library_path' in json_data['layer']: + current_path = json_data['layer']['library_path'] + if current_path == "liblsfg-vk.so": + json_data['layer']['library_path'] = "../../../lib/liblsfg-vk.so" + self.log.info(f"Fixed library_path from '{current_path}' to '../../../lib/liblsfg-vk.so'") + + # Write the modified JSON file + with open(dst_file, 'w') as f: + json.dump(json_data, f, indent=2) + + except (json.JSONDecodeError, KeyError, OSError) as e: + self.log.error(f"Error fixing JSON file {src_file}: {e}") + # Fallback to simple copy if JSON modification fails + shutil.copy2(src_file, dst_file) + def _create_config_file(self) -> None: """Create the TOML config file in ~/.config/lsfg-vk with default configuration and detected DLL path""" # Import here to avoid circular imports |
