file browser: fallback to home directory when last visited directory is not accessible
This commit is contained in:
parent
6f26e53f82
commit
df8e4bbcbf
2 changed files with 11 additions and 2 deletions
|
|
@ -8,6 +8,7 @@
|
|||
- patchbay: `address` not working properly when set to `auto`
|
||||
- patchbay: `ignoreDefaults` not working properly
|
||||
- editor: missing position indicator in color picker pad
|
||||
- file browser: fallback to home directory when last visited directory is not accessible
|
||||
|
||||
- mobile
|
||||
- apply root's (or themes) background color the the browser's topbar when possible
|
||||
|
|
|
|||
|
|
@ -491,8 +491,16 @@ module.exports = {
|
|||
listDir(data, clientId) {
|
||||
// remote file browser backend
|
||||
|
||||
if (data.path) data.path[0] = resolveHomeDir(data.path[0])
|
||||
else data.path = [settings.read('last-dir') || resolveHomeDir('~/')]
|
||||
if (data.path) {
|
||||
// path is requested
|
||||
data.path[0] = resolveHomeDir(data.path[0])
|
||||
} else if (settings.read('last-dir') && fs.existsSync(settings.read('last-dir'))) {
|
||||
// attempt to use last visited directory
|
||||
data.path = [settings.read('last-dir')]
|
||||
} else {
|
||||
// default directory fallback
|
||||
data.path = [resolveHomeDir('~/')]
|
||||
}
|
||||
|
||||
var p = path.resolve(...data.path),
|
||||
root = resolveHomeDir(settings.read('remote-root'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue