mirror of https://github.com/FreeTubeApp/FreeTube
Skip the exists check for the databases, as stat does it anyway (#3272)
This commit is contained in:
parent
da0c06902b
commit
3225b3759a
|
@ -6,12 +6,13 @@ if (process.env.IS_ELECTRON_MAIN) {
|
|||
const { app } = require('electron')
|
||||
const { join } = require('path')
|
||||
// this code only runs in the electron main process, so hopefully using sync fs code here should be fine 😬
|
||||
const { existsSync, statSync, realpathSync } = require('fs')
|
||||
const { statSync, realpathSync } = require('fs')
|
||||
const userDataPath = app.getPath('userData') // This is based on the user's OS
|
||||
dbPath = (dbName) => {
|
||||
let path = join(userDataPath, `${dbName}.db`)
|
||||
|
||||
if (existsSync(path) && statSync(path).isSymbolicLink) {
|
||||
// returns undefined if the path doesn't exist
|
||||
if (statSync(path, { throwIfNoEntry: false })?.isSymbolicLink) {
|
||||
path = realpathSync(path)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue