mirror of
https://github.com/jely2002/youtube-dl-gui.git
synced 2021-11-01 22:46:21 +03:00
improvement: add ffmpeg check and copy it again if the file is missing (#153)
This commit is contained in:
@@ -48,6 +48,7 @@ class Filepaths {
|
||||
this.settings = path.join(this.persistentPath, "userSettings");
|
||||
this.taskList = path.join(this.persistentPath, "taskList");
|
||||
this.ytdlVersion = path.join(this.persistentPath, "ytdlVersion");
|
||||
this.checkFfmpeg();
|
||||
break;
|
||||
case "darwin":
|
||||
this.packedPrefix = this.appPath;
|
||||
@@ -71,6 +72,7 @@ class Filepaths {
|
||||
this.settings = this.app.isPackaged ? path.join(this.persistentPath, "userSettings") : "userSettings";
|
||||
this.taskList = this.app.isPackaged ? path.join(this.persistentPath, "taskList") : "taskList";
|
||||
this.ytdlVersion = this.app.isPackaged ? path.join(this.persistentPath, "ytdlVersion") :"binaries/ytdlVersion";
|
||||
this.checkFfmpeg();
|
||||
this.setPermissions()
|
||||
break;
|
||||
}
|
||||
@@ -102,6 +104,17 @@ class Filepaths {
|
||||
else return process.platform;
|
||||
}
|
||||
|
||||
checkFfmpeg() {
|
||||
try {
|
||||
fs.promises.access(this.ffmpeg, fs.constants.F_OK).catch(() => {
|
||||
const from = path.join(this.unpackedPrefix, "binaries");
|
||||
fs.copyFileSync(path.join(from, path.basename(this.ffmpeg)), this.ffmpeg);
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
setPermissions() {
|
||||
fs.chmod(this.ytdl, 0o755, (err) => {
|
||||
if(err) console.error(err);
|
||||
|
||||
Reference in New Issue
Block a user