mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 02:05:06 +02:00
Fix directory writable check (fs.access not working on Windows)
This commit is contained in:
parent
6f6395bad7
commit
8f7a420cca
3 changed files with 30 additions and 15 deletions
|
@ -3,6 +3,7 @@ const which = require('../libs/which')
|
|||
const fs = require('../libs/fsExtra')
|
||||
const ffbinaries = require('../libs/ffbinaries')
|
||||
const Logger = require('../Logger')
|
||||
const fileUtils = require('../utils/fileUtils')
|
||||
|
||||
class BinaryManager {
|
||||
|
||||
|
@ -64,16 +65,10 @@ class BinaryManager {
|
|||
async install(binaries) {
|
||||
if (binaries.length == 0) return
|
||||
Logger.info(`[BinaryManager] Installing binaries: ${binaries.join(', ')}`)
|
||||
let destination = this.mainInstallPath
|
||||
try {
|
||||
await fs.access(destination, fs.constants.W_OK)
|
||||
} catch (err) {
|
||||
destination = this.altInstallPath
|
||||
}
|
||||
let destination = await fileUtils.isWritable(this.mainInstallPath) ? this.mainInstallPath : this.altInstallPath
|
||||
await ffbinaries.downloadBinaries(binaries, { destination })
|
||||
Logger.info(`[BinaryManager] Binaries installed to ${destination}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = BinaryManager
|
Loading…
Add table
Add a link
Reference in a new issue