Check for existence before creating hidden and download directories

pull/359/head
aandrew-me 1 week ago
parent 3c4ee32c59
commit e9976db5d3

@ -168,11 +168,13 @@ class YtDownloaderApp {
const userHomeDir = homedir();
const hiddenDir = join(userHomeDir, ".ytDownloader");
if (!existsSync(hiddenDir)) {
try {
mkdirSync(hiddenDir, {recursive: true});
} catch (error) {
console.log(error);
}
}
let defaultDownloadDir = join(userHomeDir, "Downloads");
if (platform() === "linux") {
@ -210,8 +212,11 @@ class YtDownloaderApp {
}
$(CONSTANTS.DOM_IDS.PATH_DISPLAY).textContent = this.state.downloadDir;
if (!existsSync(this.state.downloadDir)) {
mkdirSync(this.state.downloadDir, {recursive: true});
}
}
/**
* Checks localStorage to determine if the tray icon should be used.

Loading…
Cancel
Save