diff --git a/build_scripts/download_assets.py b/build_scripts/download_assets.py index c29c1c555..c84a1811f 100644 --- a/build_scripts/download_assets.py +++ b/build_scripts/download_assets.py @@ -1,4 +1,4 @@ -#Copyright(c) 2016-2024 Panos Karabelas +#Copyright(c) 2016-2025 Panos Karabelas # #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal @@ -25,7 +25,8 @@ def main(): file_utilities.download_file(file_url, file_destination, file_expected_hash) - file_utilities.extract_archive(file_destination, "project/", True, True) + file_utilities.extract_archive(file_destination, "project/") + input() if __name__ == "__main__": main() diff --git a/build_scripts/file_utilities.py b/build_scripts/file_utilities.py index 4b882435d..3250cd59d 100644 --- a/build_scripts/file_utilities.py +++ b/build_scripts/file_utilities.py @@ -73,33 +73,36 @@ def download_file(url, destination, expected_hash): if calculate_file_hash(destination) != expected_hash: print(f"ERROR, hash mismatch for {destination}") return + +def extract_archive(archive_path, destination_path): + # Check if 7z.exe exists locally + current_dir_7z = Path("7z.exe") + if current_dir_7z.exists(): + seven_zip_exe = current_dir_7z + else: + # define the path where 7z.exe should be if not in the current directory + seven_zip_exe = Path("build_scripts") / "7z.exe" + seven_zip_exe = seven_zip_exe.resolve() -def extract_archive(archive_path, destination_path, is_windows, use_working_dir=False): - # determine the path to 7z based on the use_working_dir flag - seven_zip_exe = Path("build_scripts") / ("7z.exe" if is_windows else "7za") - seven_zip_exe = seven_zip_exe.resolve() if use_working_dir else seven_zip_exe + # check if the 7z executable exists + if not os.path.exists(seven_zip_exe): + raise FileNotFoundError(f"The 7z executable was not found at {seven_zip_exe}. Please check the path or installation.") - # convert paths to string for subprocess, ensuring they are quoted if they contain spaces - archive_path_str = f'"{Path(archive_path).resolve()}"' - destination_path_str = f'"{Path(destination_path).resolve()}"' + archive_path_str = str(Path(archive_path).resolve()) + destination_path_str = str(Path(destination_path).resolve()) - # construct the command as a string with quoted paths - cmd = f'{str(seven_zip_exe)} x {archive_path_str} -o{destination_path_str} -aoa' + cmd = [str(seven_zip_exe), 'x', archive_path_str, '-o'+destination_path_str, '-aoa'] print(f"Extracting {archive_path} to {destination_path} using: {seven_zip_exe}") try: - # execute the command with shell=True to handle paths with spaces - result = subprocess.run(cmd, check=True, shell=True, capture_output=True, text=True) + result = subprocess.run(cmd, check=True, capture_output=True, text=True) print(result.stdout) except subprocess.CalledProcessError as e: print(f"An error occurred while extracting: {e}") print(f"Error output: {e.stderr}") - raise # re-raise the exception for higher-level error handling if needed - except FileNotFoundError: - print(f"The 7z executable was not found at {seven_zip_exe}. Please check the path or installation.") raise - + def copy(source, destination): def on_rm_error(func, path, exc_info): os.chmod(path, stat.S_IWRITE) diff --git a/build_scripts/generate_project_files.py b/build_scripts/generate_project_files.py index 9dae6f4f4..fac20bf8b 100644 --- a/build_scripts/generate_project_files.py +++ b/build_scripts/generate_project_files.py @@ -101,7 +101,7 @@ def main(): library_destination = Path("third_party") / "libraries" / "libraries.7z" library_expected_hash = '8a20305ee9658dfdfba2aea88f26e6ee3d1330d7e6d26f42bc07bb76150ff1c5' file_utilities.download_file(library_url, str(library_destination), library_expected_hash) - file_utilities.extract_archive(str(library_destination), str(Path("third_party") / "libraries"), sys.argv[1] == "vs2022", False) + file_utilities.extract_archive(str(library_destination), str(Path("third_party") / "libraries")) print("3. Copying required DLLs to the binary directory...") for lib in paths["third_party_libs"].values(): diff --git a/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp b/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp index c7437e29e..7fcfa107c 100644 --- a/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp +++ b/runtime/RHI/Vulkan/Vulkan_FidelityFX.cpp @@ -916,7 +916,7 @@ namespace spartan } // release static resources now so that they register - // themselfs with the RHI for deletion before engine shutdown + // themselves with the RHI for deletion before engine shutdown brixelizer_gi::texture_sdf_atlas = nullptr; brixelizer_gi::buffer_brick_aabbs = nullptr; brixelizer_gi::buffer_scratch = nullptr;