Fix issue with spaced paths

pull/180/head
Andrew 2 years ago
parent 9fe8d60f50
commit d74636d4cb

@ -4,7 +4,7 @@
"yt-dlp-wrap-plus": "^2.3.18" "yt-dlp-wrap-plus": "^2.3.18"
}, },
"name": "ytdownloader", "name": "ytdownloader",
"version": "3.15.0", "version": "3.15.1",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",

@ -6,7 +6,7 @@ const fs = require("fs");
const {execSync} = require("child_process"); const {execSync} = require("child_process");
let url; let url;
const ytDlp = localStorage.getItem("ytdlp"); const ytDlp = localStorage.getItem("ytdlp");
const ytdlp = new YTDlpWrap(ytDlp); const ytdlp = new YTDlpWrap(`"${ytDlp}"`);
let downloadDir = localStorage.getItem("downloadPath"); let downloadDir = localStorage.getItem("downloadPath");
getId("path").textContent = downloadDir; getId("path").textContent = downloadDir;
const i18n = new (require("../translations/i18n"))(); const i18n = new (require("../translations/i18n"))();

@ -132,7 +132,7 @@ async function downloadYtdlp() {
getId("popupBox").style.display = "none"; getId("popupBox").style.display = "none";
ytDlp = ytdlpPath; ytDlp = ytdlpPath;
ytdlp = new YTDlpWrap(ytDlp); ytdlp = new YTDlpWrap(`"${ytDlp}"`);
localStorage.setItem("ytdlp", ytDlp); localStorage.setItem("ytdlp", ytDlp);
getId("pasteUrl").style.display = "inline-block"; getId("pasteUrl").style.display = "inline-block";
console.log("yt-dlp bin Path: " + ytDlp); console.log("yt-dlp bin Path: " + ytDlp);
@ -142,7 +142,7 @@ async function downloadYtdlp() {
const fullYtdlpBinIsPresent = !!localStorage.getItem("fullYtdlpBinPresent"); const fullYtdlpBinIsPresent = !!localStorage.getItem("fullYtdlpBinPresent");
cp.exec(`${ytdlpPath} --version`, (error, stdout, stderr) => { cp.exec(`"${ytdlpPath}" --version`, (error, stdout, stderr) => {
if (error || !fullYtdlpBinIsPresent) { if (error || !fullYtdlpBinIsPresent) {
getId("popupBox").style.display = "block"; getId("popupBox").style.display = "block";
process.on("uncaughtException", (reason, promise) => { process.on("uncaughtException", (reason, promise) => {
@ -164,7 +164,7 @@ cp.exec(`${ytdlpPath} --version`, (error, stdout, stderr) => {
} else { } else {
console.log("yt-dlp binary is present in PATH"); console.log("yt-dlp binary is present in PATH");
ytDlp = ytdlpPath; ytDlp = ytdlpPath;
ytdlp = new YTDlpWrap(ytDlp); ytdlp = new YTDlpWrap(`"${ytDlp}"`);
localStorage.setItem("ytdlp", ytDlp); localStorage.setItem("ytdlp", ytDlp);
cp.spawn(`${ytDlp}`, ["-U"]).stdout.on("data", (data) => cp.spawn(`${ytDlp}`, ["-U"]).stdout.on("data", (data) =>
console.log(data.toString("utf8")) console.log(data.toString("utf8"))
@ -260,7 +260,7 @@ async function getInfo(url) {
let info = ""; let info = "";
const infoProcess = cp.spawn( const infoProcess = cp.spawn(
ytDlp, `"${ytDlp}"`,
[ [
"-j", "-j",
"--no-playlist", "--no-playlist",

Loading…
Cancel
Save