Fix navigating back to project with no main.kcl

This commit is contained in:
49lf
2024-08-02 11:56:11 -04:00
parent e7aeed4053
commit 5fcf9321e4
2 changed files with 5 additions and 6 deletions

View File

@ -249,7 +249,7 @@ const collectAllFilesRecursiveFrom = async (path: string) => {
return entry
}
const getDefaultKclFileForDir = async (projectDir: string, file: FileEntry) => {
export const getDefaultKclFileForDir = async (projectDir: string, file: FileEntry) => {
// Make sure the dir is a directory.
const isFileEntryDir = await window.electron.statIsDirectory(projectDir)
if (!isFileEntryDir) {

View File

@ -90,14 +90,13 @@ export const fileLoader: LoaderFunction = async (
let code = ''
if (!urlObj.pathname.endsWith('/settings')) {
// TODO: PROJECT_ENTRYPOINT is hardcoded
// until we support setting a project's entrypoint file
if (!current_file_name || !current_file_path || !project_name) {
const project = await getProjectInfo(project_path)
return redirect(
`${paths.FILE}/${encodeURIComponent(
`${params.id}${
isDesktop() ? window.electron.path.sep : '/'
}${PROJECT_ENTRYPOINT}`
isDesktop()
? project.default_file
: (params.id + '/' + PROJECT_ENTRYPOINT)
)}`
)
}