Skip to content

Commit

Permalink
Fixed path bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PotatoParser committed Jan 19, 2019
1 parent 523feb3 commit f16e7e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const cp = require("child_process");
const fs = require("fs");
const system = require(__dirname + "/verify.js");
if (!fs.existsSync(system.path)) cp.execSync(`node --no-warnings download.js ${system.url} ${process.platform}${process.arch}`, {cwd: process.cwd(), stdio: "inherit"});
if (!fs.existsSync(system.path)) cp.execSync(`node --no-warnings ${__dirname}/download.js ${system.url} ${process.platform}${process.arch}`, {cwd: process.cwd(), stdio: "inherit"});
class FFmpeg {
static async run(cmd){
var temp = await new Promise((resolve, reject)=>{
Expand All @@ -18,9 +18,10 @@ class FFmpeg {
return cp.execSync(`"${system.path}" ${cmd}`, {encoding: "utf8"});
}
}
// Check for possible corruption
try {
FFmpeg.runSync("-version");
} catch(err) {
cp.execSync(`node download.js ${system.url} ${process.platform}${process.arch}`, {cwd: process.cwd(), stdio: "inherit"});
cp.execSync(`node --no-warnings ${__dirname}/download.js ${system.url} ${process.platform}${process.arch}`, {cwd: process.cwd(), stdio: "inherit"});
}
module.exports = FFmpeg;

0 comments on commit f16e7e0

Please sign in to comment.