From 73f6fa75245d52d20e49789a64b5e3b1e3fe6fd4 Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 12 Nov 2025 20:24:45 +0100 Subject: [PATCH] fixed the code so that it now returns the actual path of the file --- electron/main/preload.js | 3 +++ electron/main/script.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/electron/main/preload.js b/electron/main/preload.js index 80eecb8..ec7ff05 100644 --- a/electron/main/preload.js +++ b/electron/main/preload.js @@ -9,6 +9,9 @@ try { contextBridge.exposeInMainWorld("extractor", { extract: (file) => ipcRenderer.send("extract", file) }) + contextBridge.exposeInMainWorld("electronAPI", { + getFilePath: (file) => {return webUtils.getPathForFile(file)} + }) } catch (error) { console.log("Error in preload.js"); } diff --git a/electron/main/script.js b/electron/main/script.js index 244b557..b947cdb 100644 --- a/electron/main/script.js +++ b/electron/main/script.js @@ -23,7 +23,7 @@ function checkBoxes() { if(isChecked){ //Code to submit the video - var pathTest = fileName.textContent + ""; + var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]); if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){ window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"}) } @@ -32,7 +32,7 @@ function checkBoxes() { alert('Please select at least one document type.'); } } catch (error) { - console.log("Error") + console.log(error) } // mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./a.mp4", outputType:"wav"})