File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,13 @@ export async function openDefaultFolder() {
6262 name : name ?. trim ( ) ?? webdavUri . authority ,
6363 } ,
6464 ) ;
65+ const openedPath = await fetch ( "/syscall/getOpenedFile" ) . then ( r => r . text ( ) ) ;
66+ if ( openedPath ) {
67+ console . log ( "opened path: " , openedPath ) ;
68+ const document = await vscode . workspace . openTextDocument ( vscode . Uri . parse ( ( "https://dav.puter.com/" + openedPath ) . trim ( ) . replace ( / ^ h t t p / i, 'webdav' ) ) ) ;
69+ await vscode . window . showTextDocument ( document ) ;
70+ console . log ( "done opening" )
71+ }
6572}
6673
6774export async function openWebdav ( ) {
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ function initComlink() {
3535 sharedObject . getFilePath = getFilePath ;
3636 sharedObject . ensureAuth = ensureAuth ;
3737 sharedObject . getUsername = getUsername ;
38+ sharedObject . href = location . href ;
3839 // console.log("shared object: ", _runInSW);
3940}
4041
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ let routes = {
3939 await sharedObject . ensureAuth ( ) ;
4040 }
4141 return new Response ( await sharedObject . puter . authToken ) ;
42+ } ,
43+ [ '/syscall/getOpenedFile' ] : async function ( response ) {
44+ await readyPromise ;
45+ return new Response ( ( new URL ( await sharedObject . href ) . searchParams . get ( "puter.item.path" ) ?? '' ) . replace ( "~" , "/" + await sharedObject . getUsername ( ) ) ) ;
4246 }
4347 }
4448}
You can’t perform that action at this time.
0 commit comments