Skip to content

Commit

Permalink
Support both absolute and relative paths, fix #1320
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Oct 24, 2020
1 parent b5cc1a9 commit 1584df9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Api = require("ubports-api-node-module").Installer;

var winston = require("winston");
const path = require("path");
const fs = require("fs-extra");
const url = require("url");
const events = require("events");
class event extends events {}
Expand Down Expand Up @@ -101,7 +102,13 @@ cli
.parse(process.argv);

if (cli.file) {
global.installConfig = require(path.join(process.cwd(), cli.file));
try {
global.installConfig = fs.readJsonSync(
path.isAbsolute(cli.file) ? cli.file : path.join(process.cwd(), cli.file)
);
} catch (error) {
throw new Error(`failed to read config file ${cli.file}: ${error}`);
}
}

global.installProperties = {
Expand Down

0 comments on commit 1584df9

Please sign in to comment.