From 788b7598b0772d79015804d61f76a3aff4dfa2e3 Mon Sep 17 00:00:00 2001 From: MathieuG-P Date: Sun, 6 Nov 2022 01:33:03 +0100 Subject: [PATCH] add protocol to support system file link --- src/main/main.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/main.ts b/src/main/main.ts index 9003ae63..6612f4b7 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -9,7 +9,7 @@ * `./src/main.js` using webpack. This gives us some performance wins. */ import path from 'path'; -import { app } from 'electron'; +import { app, protocol } from 'electron'; import log from 'electron-log'; import './ipcs'; import { UtilsService } from './services/utils.service'; @@ -62,4 +62,11 @@ app.on('window-all-closed', () => { app.whenReady().then(() => { createWindow(); -}).catch(log.error); \ No newline at end of file +}).catch(log.error); + +app.whenReady().then(() => { + protocol.registerFileProtocol('file', (request, callback) => { + const pathname = decodeURI(request.url.replace('file:///', '')); + callback(pathname); + }); + }); \ No newline at end of file