Skip to content

Commit

Permalink
refactor: use assert the way it was intended
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Feb 23, 2021
1 parent 4820958 commit fac4300
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/cosmic-swingset/lib/ag-solo/init-basedir.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export default function initBasedir(
options.wallet = wallet;

const here = __dirname;
if (
fs.existsSync(basedir) &&
!fs.existsSync(path.join(basedir, 'ag-cosmos-helper-address'))
) {
assert.fail(X`${basedir} must not already exist`);
}
// We either need a basedir with an initialised key, or no basedir.
assert(
fs.existsSync(path.join(basedir, 'ag-cosmos-helper-address')) ||
!fs.existsSync(basedir),
X`${basedir} must not already exist`,
);

fs.mkdirSync(basedir, { mode: 0o700, recursive: true });

Expand Down

0 comments on commit fac4300

Please sign in to comment.