fragment: add fallback property

This commit is contained in:
jean-emmanuel 2022-11-09 10:14:54 +01:00
parent c7ce398632
commit 2552dd187e
4 changed files with 43 additions and 5 deletions

View file

@ -19,6 +19,7 @@ class FragmentManager {
then(result)
}, (error)=>{
ipc.send('errorLog', `Could not open fragment file:\n ${error}`, clientId)
ipc.send('fragmentLoad', {path: path, notFound: true})
this.deleteFragment(path)
})
@ -29,7 +30,10 @@ class FragmentManager {
var path = data.path
var resolvedPath = resolvePath(path, clientId)
if (!resolvedPath) return ipc.send('errorLog', `Fragment file not found: ${path}`, clientId)
if (!resolvedPath) {
ipc.send('fragmentLoad', {path: path, notFound: true})
return
}
if (!this.clients[resolvedPath]) this.clients[resolvedPath] = []
if (!this.clients[resolvedPath].includes(clientId)) this.clients[resolvedPath].push(clientId)