File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,13 @@ export class FileSystemDrive implements Contents.IDrive {
177177 throw new Error ( 'No root file handle' ) ;
178178 }
179179
180- const handle = await root . getFileHandle ( path ) ;
180+ let parentHandle = root ;
181+ // If saving a file that is not under root, we need the right directory handle
182+ for ( const subPath of path . split ( '/' ) . slice ( 0 , - 1 ) ) {
183+ parentHandle = await parentHandle . getDirectoryHandle ( subPath ) ;
184+ }
185+
186+ const handle = await parentHandle . getFileHandle ( PathExt . basename ( path ) ) ;
181187 const writable = await handle . createWritable ( { } ) ;
182188
183189 const format = options ?. format ;
@@ -196,18 +202,14 @@ export class FileSystemDrive implements Contents.IDrive {
196202 throw new Error ( 'Method not implemented.' ) ;
197203 }
198204
199- async createCheckpoint (
200- path : string
201- ) : Promise < Contents . ICheckpointModel > {
205+ async createCheckpoint ( path : string ) : Promise < Contents . ICheckpointModel > {
202206 return {
203207 id : 'test' ,
204208 last_modified : new Date ( ) . toISOString ( )
205209 } ;
206210 }
207211
208- async listCheckpoints (
209- path : string
210- ) : Promise < Contents . ICheckpointModel [ ] > {
212+ async listCheckpoints ( path : string ) : Promise < Contents . ICheckpointModel [ ] > {
211213 return [
212214 {
213215 id : 'test' ,
You can’t perform that action at this time.
0 commit comments