diff --git a/README.md b/README.md index 2311e79..bb86610 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,9 @@ $ ./vortex-linux setConfig STEAM_RUNTIME_PATH $HOME/.steam/steam/steamapps/commo { "STEAM_RUNTIME_PATH": "/home/pikdum/.steam/steam/steamapps/common/SteamLinuxRuntime_sniper" } +$ ./vortex-linux protonRunUrl https://download.visualstudio.microsoft.com/download/pr/85473c45-8d91-48cb-ab41-86ec7abc1000/83cd0c82f0cde9a566bae4245ea5a65b/windowsdesktop-runtime-6.0.16-win-x64.exe /q +Running: /tmp/windowsdesktop-runtime-6.0.16-win-x64.exe /q +... $ ./vortex-linux installVortex vortex-setup-1.8.3.exe ... $ ./vortex-linux setupVortexDesktop diff --git a/src/lib/proton.js b/src/lib/proton.js index 585630a..22d6c32 100644 --- a/src/lib/proton.js +++ b/src/lib/proton.js @@ -100,3 +100,32 @@ export const setProton = (protonBuild) => { console.error("Error setting Proton:", error); } }; + +export const protonRunUrl = async (downloadUrl, args) => { + const tempFilePath = path.join(os.tmpdir(), path.basename(downloadUrl)); + + let command = tempFilePath; + if (args) { + command += ` ${args}`; + } + + try { + // Download the file + const response = await fetch(downloadUrl); + if (!response.ok) { + throw new Error( + `Failed to download file (${response.status} ${response.statusText})` + ); + } + await pipelineAsync(response.body, fs.createWriteStream(tempFilePath)); + + // Run protonRun with the command + console.log(`Running: ${command}`); + await protonRun(command); + } finally { + // Clean up the temporary file + if (fs.existsSync(tempFilePath)) { + fs.unlinkSync(tempFilePath); + } + } +}; diff --git a/src/main.js b/src/main.js index fe7a834..f70d638 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,6 @@ import { program } from "commander"; -import { downloadProton, setProton } from "./lib/proton.js"; +import { downloadProton, setProton, protonRunUrl } from "./lib/proton.js"; import { downloadVortex, installVortex, @@ -84,4 +84,11 @@ program console.log(JSON.stringify(getConfig(), null, 2)); }); +program + .command("protonRunUrl [args]") + .description("Download and run an .exe") + .action(async (downloadUrl, args) => { + await protonRunUrl(downloadUrl, args); + }); + program.parse(process.argv);