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 {
177
177
throw new Error ( 'No root file handle' ) ;
178
178
}
179
179
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 ) ) ;
181
187
const writable = await handle . createWritable ( { } ) ;
182
188
183
189
const format = options ?. format ;
@@ -196,18 +202,14 @@ export class FileSystemDrive implements Contents.IDrive {
196
202
throw new Error ( 'Method not implemented.' ) ;
197
203
}
198
204
199
- async createCheckpoint (
200
- path : string
201
- ) : Promise < Contents . ICheckpointModel > {
205
+ async createCheckpoint ( path : string ) : Promise < Contents . ICheckpointModel > {
202
206
return {
203
207
id : 'test' ,
204
208
last_modified : new Date ( ) . toISOString ( )
205
209
} ;
206
210
}
207
211
208
- async listCheckpoints (
209
- path : string
210
- ) : Promise < Contents . ICheckpointModel [ ] > {
212
+ async listCheckpoints ( path : string ) : Promise < Contents . ICheckpointModel [ ] > {
211
213
return [
212
214
{
213
215
id : 'test' ,
You can’t perform that action at this time.
0 commit comments