try loading data.json from `./bw-data`

This commit is contained in:
Kyle Spearrin 2020-03-09 12:06:38 -04:00
parent fe9268fffb
commit d91a24a8e9
1 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import * as fs from 'fs';
import * as jsdom from 'jsdom';
import * as path from 'path';
@ -74,7 +75,10 @@ export class Main {
constructor() {
let p = null;
if (process.env.BITWARDENCLI_APPDATA_DIR) {
const relativeDataDir = path.join(process.execPath, 'bw-data');
if (fs.existsSync(relativeDataDir)) {
p = relativeDataDir;
} else if (process.env.BITWARDENCLI_APPDATA_DIR) {
p = path.resolve(process.env.BITWARDENCLI_APPDATA_DIR);
} else if (process.platform === 'darwin') {
p = path.join(process.env.HOME, 'Library/Application Support/Bitwarden CLI');