@@ -432,9 +432,14 @@ export class PreviewModel implements ViewModel {
432
432
const fileInfo = await getFn ( this . statFile ) ;
433
433
const fileName = await getFn ( this . statFilePath ) ;
434
434
const editMode = getFn ( this . editMode ) ;
435
+ const parentFileInfo = await this . getParentInfo ( fileInfo ) ;
436
+ console . log ( parentFileInfo ) ;
435
437
438
+ if ( parentFileInfo ?. notfound ?? false ) {
439
+ return { errorStr : `Parent Directory Not Found: ${ fileInfo . path } ` } ;
440
+ }
436
441
if ( fileInfo ?. notfound ) {
437
- return { errorStr : `File Not Found: ${ fileInfo . path } ` } ;
442
+ return { specializedView : "codeedit" } ;
438
443
}
439
444
if ( mimeType == null ) {
440
445
return { errorStr : `Unable to determine mimetype for: ${ fileInfo . path } ` } ;
@@ -492,6 +497,18 @@ export class PreviewModel implements ViewModel {
492
497
services . ObjectService . UpdateObjectMeta ( blockOref , updateMeta ) ;
493
498
}
494
499
500
+ async getParentInfo ( fileInfo : FileInfo ) : Promise < FileInfo | undefined > {
501
+ const conn = globalStore . get ( this . connection ) ;
502
+ try {
503
+ const parentFileInfo = await RpcApi . RemoteFileJoinCommand ( WindowRpcClient , [ fileInfo . path , ".." ] , {
504
+ route : makeConnRoute ( conn ) ,
505
+ } ) ;
506
+ return parentFileInfo ;
507
+ } catch {
508
+ return undefined ;
509
+ }
510
+ }
511
+
495
512
async goParentDirectory ( ) {
496
513
const fileInfo = await globalStore . get ( this . statFile ) ;
497
514
if ( fileInfo == null ) {
@@ -500,7 +517,7 @@ export class PreviewModel implements ViewModel {
500
517
}
501
518
const conn = globalStore . get ( this . connection ) ;
502
519
try {
503
- const newFileInfo = await RpcApi . RemoteFileJoinCommand ( WindowRpcClient , [ fileInfo . dir , ".." ] , {
520
+ const newFileInfo = await RpcApi . RemoteFileJoinCommand ( WindowRpcClient , [ fileInfo . path , ".." ] , {
504
521
route : makeConnRoute ( conn ) ,
505
522
} ) ;
506
523
console . log ( newFileInfo . path ) ;
0 commit comments