Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions client/electron/assets/installer.nsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
!define WINFSP_VERSION "2.1.25156"
!define WINFSP_FILE "winfsp-${WINFSP_VERSION}.msi"
!define VC_REDIST_FILE "vc_redist.x64.exe"

!macro installWinFSP
File /oname=$PLUGINSDIR\${WINFSP_FILE} ${PROJECT_DIR}\build\${WINFSP_FILE}
Expand All @@ -25,6 +26,12 @@
${EndIf}
!macroend

!macro installVCRedist
File /oname=$PLUGINSDIR\${VC_REDIST_FILE} ${PROJECT_DIR}\build\${VC_REDIST_FILE}
ExecWait '"$PLUGINSDIR\${VC_REDIST_FILE}" /install /passive /norestart'
!macroend

!macro customInstall
!insertmacro mayInstallWinFSP
!insertmacro installVCRedist

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This always install VC, it should check if it's not already installed

@Max-7 Max-7 May 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, the check doesn't even work properly with WinFSP, I always get a pop-up, so why bother?
You get a pop-up, you click next, if it needs to be installed it's installed. One option could also be to run it as /quiet instead of /passive, which doesn't even display a pop-up (appart maybe from Windows UAC). I put /passive because it's what we're doing with WinFSP and it seems a little more transparent.

!macroend
10 changes: 9 additions & 1 deletion client/electron/package.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,15 @@ const options = {
buildResources: 'assets',
},

files: ['assets/**/*', '!assets/installer.nsh', 'build/**/*', '!build/**/*.js.map', '!build/**/*.msi', 'app/**/*'],
files: [
'assets/**/*',
'!assets/installer.nsh',
'build/**/*',
'!build/**/*.js.map',
'!build/**/*.msi',
'!build/vc_redist.x64.exe',
'app/**/*',
],

publish: publishConfig,

Expand Down
19 changes: 15 additions & 4 deletions client/electron/scripts/before-pack.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ const WINFSP_URL = `https://github.com/winfsp/winfsp/releases/download/${WINFSP_
const WINFSP_SHA256SUM = 'Bzpw4A93Qj40vtmLhuYA3vkzk7pYIiBPrFeikyTbn3o=';
const WINFSP_DEST_FILE = `build/winfsp-${WINFSP_VERSION}.msi`;

// Stable permalink to the latest VC++ 2015-2022 redistributable (covers vc14–vc17).
// No version pinning is possible with this URL, so no sha256 verification.
const VC_REDIST_URL = 'https://aka.ms/vc14/vc_redist.x64.exe';
const VC_REDIST_DEST_FILE = 'build/vc_redist.x64.exe';

/**
*
* @param {string} url
* @param {string} sha256sum The expected sha256sum in base64
* @param {string | null} sha256sum The expected sha256sum in base64, or null to skip verification
* @param {path} dest
*/
async function downloadFile(url, sha256sum, dest) {
Expand Down Expand Up @@ -41,9 +46,11 @@ async function downloadFile(url, sha256sum, dest) {
});
await pipeline(httpStream, hashStream, destStream);

const fileDigest = hash.digest('base64');
if (fileDigest !== sha256sum) {
throw new Error(`Failed to download ${url}: sha256sum mismatch: got ${fileDigest} expected ${sha256sum}`);
if (sha256sum !== null) {
const fileDigest = hash.digest('base64');
if (fileDigest !== sha256sum) {
throw new Error(`Failed to download ${url}: sha256sum mismatch: got ${fileDigest} expected ${sha256sum}`);
}
}
}

Expand All @@ -57,6 +64,10 @@ exports.default = async function beforePack(context) {
await downloadFile(WINFSP_URL, WINFSP_SHA256SUM, WINFSP_DEST_FILE).then(() =>
console.log(`WinFSP downloaded to ${WINFSP_DEST_FILE}`),
);
console.log('Downloading VC++ Redistributable');
await downloadFile(VC_REDIST_URL, null, VC_REDIST_DEST_FILE).then(() =>
console.log(`VC++ Redistributable downloaded to ${VC_REDIST_DEST_FILE}`),
);
break;
default:
console.log(`No hook for platform ${context.electronPlatformName}`);
Expand Down
Loading