server: drift_home already has a default (#61)

`||` on an exsiting string does nothing
This commit is contained in:
Joaquin "Florius" Azcarate 2022-04-02 00:03:21 +02:00 committed by GitHub
parent 1c2fef0ee4
commit 6a6a2a3496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"))