From 12a0c892f0732b409458bba45d19b3fdab9b6291 Mon Sep 17 00:00:00 2001 From: Anirudh Sevugan Date: Sat, 10 May 2025 00:54:49 -0500 Subject: [PATCH] Update main.js Added URL encoding for Windows file explorer opens --- simpliplay/main.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/simpliplay/main.js b/simpliplay/main.js index c763361..7163b86 100644 --- a/simpliplay/main.js +++ b/simpliplay/main.js @@ -3,7 +3,7 @@ const path = require('path'); const fs = require('fs'); const os = require('os'); const { pathToFileURL } = require("url"); -var didRegisterShortcuts = false; +let didRegisterShortcuts = false; let mainWindow; @@ -226,7 +226,8 @@ function openFileSafely(filePath) { if (mainWindow?.webContents) { mainWindow.webContents.once("did-finish-load", () => { - mainWindow.webContents.send("play-media", filePath); + const winFileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path + mainWindow.webContents.send("play-media", winFileURL); }); } @@ -238,10 +239,6 @@ function isValidFileArg(arg) { return arg && !arg.startsWith('-') && !arg.includes('electron') && fs.existsSync(arg); } - - - - app.on("window-all-closed", () => { globalShortcut.unregisterAll(); app.quit();