From 393b07866ed8344c6d99f656bb81d1bb5d8be1b4 Mon Sep 17 00:00:00 2001 From: Francois Date: Thu, 2 Jan 2025 11:42:06 +0200 Subject: [PATCH] fix binary rename step on windows --- .../app_build/build_config.json | 2 +- .../windows/CMakeLists.txt | 2 +- .../src/steps/fetch_defi_api_build_step.dart | 25 ++++++++++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/packages/komodo_defi_framework/app_build/build_config.json b/packages/komodo_defi_framework/app_build/build_config.json index 00f31d1..45da6e0 100644 --- a/packages/komodo_defi_framework/app_build/build_config.json +++ b/packages/komodo_defi_framework/app_build/build_config.json @@ -62,7 +62,7 @@ "coins": { "fetch_at_build_enabled": true, "update_commit_on_build": true, - "bundled_coins_repo_commit": "77ddee0b05d21161cb83b8dcc40f2d20af3e35ef", + "bundled_coins_repo_commit": "823310fc4985e76e5d9b80a216182bf57d24b477", "coins_repo_api_url": "https://api.github.com/repos/KomodoPlatform/coins", "coins_repo_content_url": "https://komodoplatform.github.io/coins", "coins_repo_branch": "master", diff --git a/packages/komodo_defi_framework/windows/CMakeLists.txt b/packages/komodo_defi_framework/windows/CMakeLists.txt index 55a5827..ed09646 100644 --- a/packages/komodo_defi_framework/windows/CMakeLists.txt +++ b/packages/komodo_defi_framework/windows/CMakeLists.txt @@ -63,6 +63,6 @@ foreach(FILE ${EXE_DLL_FILES}) endforeach() set(mm2_bundled_libraries - "${CMAKE_CURRENT_SOURCE_DIR}/kdf" + "${CMAKE_CURRENT_SOURCE_DIR}/bin/kdf.exe" PARENT_SCOPE ) diff --git a/packages/komodo_wallet_build_transformer/lib/src/steps/fetch_defi_api_build_step.dart b/packages/komodo_wallet_build_transformer/lib/src/steps/fetch_defi_api_build_step.dart index a88acd2..f7b5958 100644 --- a/packages/komodo_wallet_build_transformer/lib/src/steps/fetch_defi_api_build_step.dart +++ b/packages/komodo_wallet_build_transformer/lib/src/steps/fetch_defi_api_build_step.dart @@ -492,20 +492,33 @@ class FetchDefiApiStep extends BuildStep { // file build size or if it is required for cache-busting. } if (_isBinaryExecutable(platform)) { - _renameExecutable(destinationFolder); + _renameExecutable(platform, destinationFolder); _setExecutablePermissions(destinationFolder); } return Future.value(); } /// if executable is named "mm2" or "mm2.exe", then rename to "kdf" - void _renameExecutable(String destinationFolder) { - final executableName = Platform.isWindows ? 'mm2.exe' : 'mm2'; + void _renameExecutable(String platform, String destinationFolder) { + final executableName = platform == 'windows' ? 'mm2.exe' : 'mm2'; final executablePath = path.join(destinationFolder, executableName); + + _log.fine('Looking for executable at: $executablePath'); if (FileSystemEntity.isFileSync(executablePath)) { - final newExecutablePath = path.join(destinationFolder, 'kdf'); - File(executablePath).renameSync(newExecutablePath); - _log.info('Renamed executable from $executableName to kdf'); + final originalExtension = path.extension(executablePath); + final newExecutableName = 'kdf$originalExtension'; + final newExecutablePath = path.join(destinationFolder, newExecutableName); + + try { + File(executablePath).renameSync(newExecutablePath); + _log.info( + 'Renamed executable from $executableName to $newExecutableName', + ); + } catch (e) { + _log.severe('Failed to rename executable: $e'); + } + } else { + _log.severe('Executable not found at: $executablePath'); } }