server: `drift_home` already has a default (#61)

`||` on an exsiting string does nothing
pull/63/head
Joaquin "Florius" Azcarate 4 years ago committed by GitHub
parent 1c2fef0ee4
commit 6a6a2a3496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,8 +7,7 @@ import config from "./config"
// This does *not* support `~other_user/tmp` => `/home/other_user/tmp`.
function getDatabasePath() {
const fileName = "drift.sqlite"
const databasePath =
`${config.drift_home}/${fileName}` || `~/.drift/${fileName}`
const databasePath = `${config.drift_home}/${fileName}`
const home = os.homedir().replace("$", "$$$$")
return path.resolve(databasePath.replace(/^~($|\/|\\)/, home + "$1"))

Loading…
Cancel
Save