fixed the code so that it now returns the actual path of the file

This commit is contained in:
2025-11-12 20:24:45 +01:00
parent 87e3368a9a
commit 73f6fa7524
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -9,6 +9,9 @@ try {
contextBridge.exposeInMainWorld("extractor", { contextBridge.exposeInMainWorld("extractor", {
extract: (file) => ipcRenderer.send("extract", file) extract: (file) => ipcRenderer.send("extract", file)
}) })
contextBridge.exposeInMainWorld("electronAPI", {
getFilePath: (file) => {return webUtils.getPathForFile(file)}
})
} catch (error) { } catch (error) {
console.log("Error in preload.js"); console.log("Error in preload.js");
} }
+2 -2
View File
@@ -23,7 +23,7 @@ function checkBoxes() {
if(isChecked){ if(isChecked){
//Code to submit the video //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")){ if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"}) window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"})
} }
@@ -32,7 +32,7 @@ function checkBoxes() {
alert('Please select at least one document type.'); alert('Please select at least one document type.');
} }
} catch (error) { } catch (error) {
console.log("Error") console.log(error)
} }
// mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./a.mp4", outputType:"wav"}) // mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./a.mp4", outputType:"wav"})