Skip to content

Commit

Permalink
Fix usage of util.exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
soatok committed Jul 22, 2019
1 parent ef41633 commit 43fdc59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands/keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
}

// Load the existing config
if (this.exists(homedir + "/.valence/keyring.json")) {
if (await util.exists(homedir + "/.valence/keyring.json")) {
config = await util.readJson(homedir + "/.valence/keyring.json");
}
if (typeof(config['keys']) === 'undefined') {
Expand Down
3 changes: 2 additions & 1 deletion util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const inquirer = require('inquirer');
module.exports = {
exists: async function(target) {
try {
return await fsp.access(
let access = await fsp.access(
target,
fs.constants.F_OK,
(err) => {
return !err
}
);
return !access;
} catch (e) {
return false;
}
Expand Down

0 comments on commit 43fdc59

Please sign in to comment.