Update main.js

1.0.6
This commit is contained in:
Anirudh Sevugan 2025-05-10 16:45:19 -05:00 committed by GitHub
parent 12a0c892f0
commit 54a93033f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -206,7 +206,7 @@ app.whenReady().then(() => {
openFileSafely(filePath); openFileSafely(filePath);
}); });
if (process.platform === "win32") { if (["win32", "linux"].includes(process.platform)) {
if (!app.requestSingleInstanceLock()) { if (!app.requestSingleInstanceLock()) {
app.quit(); app.quit();
} else { } else {
@ -225,10 +225,8 @@ function openFileSafely(filePath) {
hasOpenedFile = true; hasOpenedFile = true;
if (mainWindow?.webContents) { if (mainWindow?.webContents) {
mainWindow.webContents.once("did-finish-load", () => {
const winFileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path const winFileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path
mainWindow.webContents.send("play-media", winFileURL); mainWindow.webContents.send("play-media", winFileURL);
});
} }
setTimeout(() => (hasOpenedFile = false), 1000); setTimeout(() => (hasOpenedFile = false), 1000);