From df810d38809342f7e9d4aa7c05f8d5bddb65d13d Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Mon, 3 Mar 2025 22:30:54 +0530 Subject: [PATCH] (fixed): failed to bundle project error running candle.exe and light.exe --- copyFiles.x86_64-pc-windows-msvc.js | 18 ++++++++++++++++++ ...e-darwin => sevenzip-aarch64-apple-darwin} | Bin ...le-darwin => sevenzip-x86_64-apple-darwin} | Bin ...xe => sevenzip-x86_64-pc-windows-msvc.exe} | Bin ...-gnu => sevenzip-x86_64-unknown-linux-gnu} | Bin src-tauri/capabilities/shell.json | 4 ++-- src-tauri/tauri.linux.conf.json | 2 +- src-tauri/tauri.macos.conf.json | 2 +- src-tauri/tauri.windows.conf.json | 14 +++++++------- src/pages/extension-manager.tsx | 2 +- 10 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 copyFiles.x86_64-pc-windows-msvc.js rename src-tauri/binaries/{7zip-aarch64-apple-darwin => sevenzip-aarch64-apple-darwin} (100%) rename src-tauri/binaries/{7zip-x86_64-apple-darwin => sevenzip-x86_64-apple-darwin} (100%) rename src-tauri/binaries/{7zip-x86_64-pc-windows-msvc.exe => sevenzip-x86_64-pc-windows-msvc.exe} (100%) rename src-tauri/binaries/{7zip-x86_64-unknown-linux-gnu => sevenzip-x86_64-unknown-linux-gnu} (100%) diff --git a/copyFiles.x86_64-pc-windows-msvc.js b/copyFiles.x86_64-pc-windows-msvc.js new file mode 100644 index 0000000..4b12e2a --- /dev/null +++ b/copyFiles.x86_64-pc-windows-msvc.js @@ -0,0 +1,18 @@ +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const msghostSrc = path.join(__dirname, 'src-tauri', 'target', 'release', 'pytubepp-helper-msghost.exe'); +const msghostDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost.exe'); +const msghostManifestWinChromeSrc = path.join(__dirname, 'src-tauri', 'msghost-manifest', 'windows', 'chrome', 'com.neosubhamoy.pytubepp.helper.json'); +const msghostManifestWinChromeDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost.json'); +const msghostManifestWinFirefoxSrc = path.join(__dirname, 'src-tauri', 'msghost-manifest', 'windows', 'firefox', 'com.neosubhamoy.pytubepp.helper.json'); +const msghostManifestWinFirefoxDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost-moz.json'); + +fs.copyFileSync(msghostSrc, msghostDest); +fs.copyFileSync(msghostManifestWinChromeSrc, msghostManifestWinChromeDest); +fs.copyFileSync(msghostManifestWinFirefoxSrc, msghostManifestWinFirefoxDest); +console.log('Files copied successfully'); \ No newline at end of file diff --git a/src-tauri/binaries/7zip-aarch64-apple-darwin b/src-tauri/binaries/sevenzip-aarch64-apple-darwin similarity index 100% rename from src-tauri/binaries/7zip-aarch64-apple-darwin rename to src-tauri/binaries/sevenzip-aarch64-apple-darwin diff --git a/src-tauri/binaries/7zip-x86_64-apple-darwin b/src-tauri/binaries/sevenzip-x86_64-apple-darwin similarity index 100% rename from src-tauri/binaries/7zip-x86_64-apple-darwin rename to src-tauri/binaries/sevenzip-x86_64-apple-darwin diff --git a/src-tauri/binaries/7zip-x86_64-pc-windows-msvc.exe b/src-tauri/binaries/sevenzip-x86_64-pc-windows-msvc.exe similarity index 100% rename from src-tauri/binaries/7zip-x86_64-pc-windows-msvc.exe rename to src-tauri/binaries/sevenzip-x86_64-pc-windows-msvc.exe diff --git a/src-tauri/binaries/7zip-x86_64-unknown-linux-gnu b/src-tauri/binaries/sevenzip-x86_64-unknown-linux-gnu similarity index 100% rename from src-tauri/binaries/7zip-x86_64-unknown-linux-gnu rename to src-tauri/binaries/sevenzip-x86_64-unknown-linux-gnu diff --git a/src-tauri/capabilities/shell.json b/src-tauri/capabilities/shell.json index 60a20e6..0b6f395 100644 --- a/src-tauri/capabilities/shell.json +++ b/src-tauri/capabilities/shell.json @@ -130,7 +130,7 @@ ] }, { - "name": "binaries/7zip", + "name": "binaries/sevenzip", "args": true, "sidecar": true } @@ -140,7 +140,7 @@ "identifier": "shell:allow-spawn", "allow": [ { - "name": "binaries/7zip", + "name": "binaries/sevenzip", "args": true, "sidecar": true } diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index be81666..bc8b5b0 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -75,7 +75,7 @@ } }, "externalBin": [ - "binaries/7zip" + "binaries/sevenzip" ] } } \ No newline at end of file diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json index 2bc8a5a..9aef264 100644 --- a/src-tauri/tauri.macos.conf.json +++ b/src-tauri/tauri.macos.conf.json @@ -73,7 +73,7 @@ "pytubepp-helper-autostart.plist" ], "externalBin": [ - "binaries/7zip" + "binaries/sevenzip" ] } } \ No newline at end of file diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index 39b3c4a..e977412 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -1,7 +1,7 @@ { "build": { "beforeDevCommand": "cargo build --manifest-path=./src-tauri/msghost/Cargo.toml && npm run dev", - "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && npm run build", + "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && node copyFiles.x86_64-pc-windows-msvc.js && npm run build", "devUrl": "http://localhost:1422", "frontendDist": "../dist" }, @@ -62,13 +62,13 @@ "installerHooks": "installer/windows/nsis-hooks.nsi" } }, - "resources": { - "msghost-manifest/windows/chrome/com.neosubhamoy.pytubepp.helper.json": "pytubepp-helper-msghost.json", - "msghost-manifest/windows/firefox/com.neosubhamoy.pytubepp.helper.json": "pytubepp-helper-msghost-moz.json", - "target/release/pytubepp-helper-msghost.exe": "pytubepp-helper-msghost.exe" - }, + "resources": [ + "pytubepp-helper-msghost.json", + "pytubepp-helper-msghost-moz.json", + "pytubepp-helper-msghost.exe" + ], "externalBin": [ - "binaries/7zip" + "binaries/sevenzip" ] } } \ No newline at end of file diff --git a/src/pages/extension-manager.tsx b/src/pages/extension-manager.tsx index 86e389e..f24aac2 100644 --- a/src/pages/extension-manager.tsx +++ b/src/pages/extension-manager.tsx @@ -101,7 +101,7 @@ export default function ExtensionManagerPage() { ); setUpdateStatus('Unpacking') - const output = await Command.sidecar('binaries/7zip', ['x', tempExtensionDownloadPath, `-o${extensionDirPath}`, '-aoa']).execute() + const output = await Command.sidecar('binaries/sevenzip', ['x', tempExtensionDownloadPath, `-o${extensionDirPath}`, '-aoa']).execute() if (output.code === 0) { console.log(output.stdout) console.log(`Unpacked ${tempExtensionDownloadPath} to ${extensionDirPath}`)