diff --git a/html/index.html b/html/index.html index 02c6d3a..fca8c9e 100644 --- a/html/index.html +++ b/html/index.html @@ -37,6 +37,7 @@ Text copied +
@@ -115,6 +116,13 @@ title="If kept empty, it will be downloaded to the end"> +

+ +
Current download location -
+ +

+ +

Subtitles

Download subtitles if available diff --git a/main.js b/main.js index e9b91c4..b10ee83 100644 --- a/main.js +++ b/main.js @@ -227,7 +227,13 @@ ipcMain.on("select-location", () => { }); if (location) { - secondaryWindow.webContents.send("downloadPath", location); + if (secondaryWindow){ + secondaryWindow.webContents.send("downloadPath", location); + } + else{ + win.webContents.send("downloadPath", location); + } + } }); diff --git a/src/preferences.js b/src/preferences.js index 86b8531..09f919c 100644 --- a/src/preferences.js +++ b/src/preferences.js @@ -30,9 +30,9 @@ getId("selectLocation").addEventListener("click", () => { }); ipcRenderer.on("downloadPath", (event, downloadPath) => { - console.log(downloadPath); - localStorage.setItem("downloadPath", downloadPath); - getId("path").textContent = downloadPath; + console.log(downloadPath[0]); + localStorage.setItem("downloadPath", downloadPath[0]); + getId("path").textContent = downloadPath[0]; }); const enabledTransparent = getId("enableTransparent"); diff --git a/src/renderer.js b/src/renderer.js index d3d159e..f0e7e1a 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -89,6 +89,7 @@ function downloadPathSelection() { downloadDir = appdir; localStorage.setItem("downloadPath", appdir); } + getId("path").textContent = downloadDir; fs.mkdir(downloadDir, { recursive: true }, () => {}); } @@ -1168,3 +1169,14 @@ getId("newPlaylistWin").addEventListener("click", () => { ipcRenderer.on("link", (event, text) => { pasteFromTray(text); }); + +// Selecting download directory +getId("selectLocation").addEventListener("click", () => { + ipcRenderer.send("select-location", ""); +}); + +ipcRenderer.on("downloadPath", (event, downloadPath) => { + console.log(downloadPath); + getId("path").textContent = downloadPath; + downloadDir = downloadPath[0] +}); \ No newline at end of file