mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
Merge pull request #207 from Araxeus/Download-Plugin-Directory-Chooser
add Download Folder Chooser
This commit is contained in:
@ -9,6 +9,8 @@ const ytpl = require("ytpl");
|
|||||||
const { sendError } = require("./back");
|
const { sendError } = require("./back");
|
||||||
const { defaultMenuDownloadLabel, getFolder } = require("./utils");
|
const { defaultMenuDownloadLabel, getFolder } = require("./utils");
|
||||||
|
|
||||||
|
const { setOptions } = require('../../config/plugins')
|
||||||
|
const { dialog } = require('electron');
|
||||||
let downloadLabel = defaultMenuDownloadLabel;
|
let downloadLabel = defaultMenuDownloadLabel;
|
||||||
|
|
||||||
module.exports = (win, options, refreshMenu) => [
|
module.exports = (win, options, refreshMenu) => [
|
||||||
@ -60,4 +62,17 @@ module.exports = (win, options, refreshMenu) => [
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Choose download folder:',
|
||||||
|
click: () => {
|
||||||
|
let result = dialog.showOpenDialogSync({
|
||||||
|
properties: ['openDirectory', 'createDirectory'],
|
||||||
|
defaultPath: getFolder(options.downloadFolder),
|
||||||
|
})
|
||||||
|
if(result) {
|
||||||
|
options.downloadFolder = result[0];
|
||||||
|
setOptions("downloader", options);
|
||||||
|
} //else = user pressed cancel
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user