file: honor server's remote-root option (remove root path from displayed path and returned value)

This commit is contained in:
jean-emmanuel 2025-09-15 09:05:37 +02:00
parent 9ef97ca1c3
commit 4dbc572ea1
4 changed files with 17 additions and 7 deletions

View file

@ -58,9 +58,13 @@ export default class File extends Widget {
directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory'),
loadDir: this.getProp('allowDir'),
save: this.getProp('mode') === 'save'
}, (path)=>{
}, (path, root)=>{
this.setValue(path.join(path[0][0] === '/' ? '/' : '\\'), {
var sep = path[0][0] === '/' ? '/' : '\\',
val = path.join(sep)
if (root) val = val.replace(root, sep).replace(sep + sep, sep)
this.setValue(val, {
sync: true,
send: true
})