Skip to content

Commit

Permalink
refactor: Additional check in resolveUserAppDataPath
Browse files Browse the repository at this point in the history
  • Loading branch information
cawa-93 committed Dec 24, 2022
1 parent aaff0cc commit 321c5f7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ interface DefineStoreOptions {
function resolveUserAppDataPath() {
const arg = process.argv.find(arg => arg.startsWith('--user-data-dir='))
if (!arg) {
throw new Error('Unable to find --user-data-dir in process.argv')
throw new Error('Unable to find --user-data-dir with valid path in process.argv')
}
const dir = arg.split('=')[1]
const dir = arg.split('=')[1]?.trim()

if (!dir) {
throw new Error('Unable to find --user-data-dir with valid path in process.argv')
}

return path.resolve(dir)
}

Expand Down

0 comments on commit 321c5f7

Please sign in to comment.