File tree stuff (#3679)
* Fix and test file tree operations * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * Make tsc happy * I've been lied to * Fix navigating to deleted file * tsc * Remove debugger statement * Fix test * All tests fixed * Remove old config and remove slowmo * fmt * Remove unintentional changelog in readme (#3678) * lint * fmt * Increase test timeout * Fix the damn test * fix web app * fmt --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com> Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
This commit is contained in:
@ -90,12 +90,24 @@ export const fileLoader: LoaderFunction = async (
|
||||
let code = ''
|
||||
|
||||
if (!urlObj.pathname.endsWith('/settings')) {
|
||||
if (!currentFileName || !currentFilePath || !projectName) {
|
||||
const fallbackFile = isDesktop()
|
||||
? (await getProjectInfo(projectPath)).default_file
|
||||
: ''
|
||||
let fileExists = isDesktop()
|
||||
if (currentFilePath && fileExists) {
|
||||
try {
|
||||
await window.electron.stat(currentFilePath)
|
||||
} catch (e) {
|
||||
if (e === 'ENOENT') {
|
||||
fileExists = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileExists || !currentFileName || !currentFilePath || !projectName) {
|
||||
return redirect(
|
||||
`${PATHS.FILE}/${encodeURIComponent(
|
||||
isDesktop()
|
||||
? (await getProjectInfo(projectPath)).default_file
|
||||
: params.id + '/' + PROJECT_ENTRYPOINT
|
||||
isDesktop() ? fallbackFile : params.id + '/' + PROJECT_ENTRYPOINT
|
||||
)}`
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user