Bug Fixes

- Fixed an issue where the app coudnt be used outside the directory where the files live
This commit is contained in:
Izuco 2021-06-28 19:32:01 +02:00
parent 7cc717dd93
commit 987f64ee0e
2 changed files with 13 additions and 9 deletions

20
funi.js
View file

@ -26,14 +26,11 @@ const getYamlCfg = require('./modules/module.cfg-loader');
const getData = require('./modules/module.getdata.js');
const vttConvert = require('./modules/module.vttconvert');
// new-cfg
const pathToFile = process.pkg ? '' : __dirname;
const binCfgFile = path.join(pathToFile, 'config', 'bin-path');
const dirCfgFile = path.join(pathToFile, 'config', 'dir-path');
const cliCfgFile = path.join(pathToFile, 'config', 'cli-defaults');
const tokenFile = path.join(pathToFile, 'config', 'token');
const workingDir = process.pkg ? path.dirname(process.execPath) : __dirname;
const binCfgFile = path.join(workingDir, 'config', 'bin-path');
const dirCfgFile = path.join(workingDir, 'config', 'dir-path');
const cliCfgFile = path.join(workingDir, 'config', 'cli-defaults');
const tokenFile = path.join(workingDir, 'config', 'token');
// params
let cfg = {
bin: getYamlCfg(binCfgFile),
@ -41,6 +38,13 @@ let cfg = {
cli: getYamlCfg(cliCfgFile),
};
/* Normalise paths for use outside the current directory */
for (let key of Object.keys(cfg.dir)) {
if (!path.isAbsolute(cfg.dir[key])) {
cfg.dir[key] = path.join(workingDir, cfg.dir[key])
}
}
// token
let token = getYamlCfg(tokenFile);
token = token.token ? token.token : false;

View file

@ -1,7 +1,7 @@
{
"name": "funimation-downloader-nx",
"short_name": "funi",
"version": "4.8.2",
"version": "4.8.3",
"description": "Download videos from Funimation via cli.",
"keywords": [
"download",