@@ -135,7 +135,7 @@ export class TempFileSystem {
135
135
// This is the parts of the vscode.workspace.fs API that we use here.
136
136
// See: https://code.visualstudio.com/api/references/vscode-api#FileSystem
137
137
// Note that we have used all the API functions *except* "rename()".
138
- interface INewAPI {
138
+ interface IVSCodeFileSystemAPI {
139
139
copy ( source : vscode . Uri , target : vscode . Uri , options ?: { overwrite : boolean } ) : Thenable < void > ;
140
140
createDirectory ( uri : vscode . Uri ) : Thenable < void > ;
141
141
delete ( uri : vscode . Uri , options ?: { recursive : boolean ; useTrash : boolean } ) : Thenable < void > ;
@@ -172,7 +172,7 @@ interface IRawPath {
172
172
export class RawFileSystem implements IRawFileSystem {
173
173
constructor (
174
174
protected readonly path : IRawPath ,
175
- protected readonly newapi : INewAPI ,
175
+ protected readonly vscfs : IVSCodeFileSystemAPI ,
176
176
protected readonly nodefs : IRawFS ,
177
177
protected readonly fsExtra : IRawFSExtra
178
178
) { }
@@ -193,14 +193,14 @@ export class RawFileSystem implements IRawFileSystem {
193
193
public async readText ( filename : string ) : Promise < string > {
194
194
const uri = vscode . Uri . file ( filename ) ;
195
195
const data = Buffer . from (
196
- await this . newapi . readFile ( uri ) ) ;
196
+ await this . vscfs . readFile ( uri ) ) ;
197
197
return data . toString ( ENCODING ) ;
198
198
}
199
199
200
200
public async writeText ( filename : string , text : string ) : Promise < void > {
201
201
const uri = vscode . Uri . file ( filename ) ;
202
202
const data = Buffer . from ( text ) ;
203
- await this . newapi . writeFile ( uri , data ) ;
203
+ await this . vscfs . writeFile ( uri , data ) ;
204
204
}
205
205
206
206
public async rmtree ( dirname : string ) : Promise < void > {
@@ -209,29 +209,29 @@ export class RawFileSystem implements IRawFileSystem {
209
209
// The docs say "throws - FileNotFound when uri doesn't exist".
210
210
// However, it happily does nothing (at least for remote-over-SSH).
211
211
// So we have to manually stat, just to be sure.
212
- await this . newapi . stat ( uri ) ;
213
- return this . newapi . delete ( uri , {
212
+ await this . vscfs . stat ( uri ) ;
213
+ return this . vscfs . delete ( uri , {
214
214
recursive : true ,
215
215
useTrash : false
216
216
} ) ;
217
217
}
218
218
219
219
public async rmfile ( filename : string ) : Promise < void > {
220
220
const uri = vscode . Uri . file ( filename ) ;
221
- return this . newapi . delete ( uri , {
221
+ return this . vscfs . delete ( uri , {
222
222
recursive : false ,
223
223
useTrash : false
224
224
} ) ;
225
225
}
226
226
227
227
public async stat ( filename : string ) : Promise < FileStat > {
228
228
const uri = vscode . Uri . file ( filename ) ;
229
- return this . newapi . stat ( uri ) ;
229
+ return this . vscfs . stat ( uri ) ;
230
230
}
231
231
232
232
public async listdir ( dirname : string ) : Promise < [ string , FileType ] [ ] > {
233
233
const uri = vscode . Uri . file ( dirname ) ;
234
- return this . newapi . readDirectory ( uri ) ;
234
+ return this . vscfs . readDirectory ( uri ) ;
235
235
}
236
236
237
237
public async mkdirp ( dirname : string ) : Promise < void > {
@@ -243,7 +243,7 @@ export class RawFileSystem implements IRawFileSystem {
243
243
const current = stack . pop ( ) || '' ;
244
244
const uri = vscode . Uri . file ( current ) ;
245
245
try {
246
- await this . newapi . createDirectory ( uri ) ;
246
+ await this . vscfs . createDirectory ( uri ) ;
247
247
} catch ( err ) {
248
248
if ( isFileExistsError ( err ) ) {
249
249
// already done!
@@ -276,8 +276,8 @@ export class RawFileSystem implements IRawFileSystem {
276
276
// destination doesn't exist". However, it happily creates
277
277
// the parent directory (at least for remote-over-SSH).
278
278
// So we have to manually stat, just to be sure.
279
- await this . newapi . stat ( vscode . Uri . file ( this . path . dirname ( dest ) ) ) ;
280
- await this . newapi . copy ( srcURI , destURI , {
279
+ await this . vscfs . stat ( vscode . Uri . file ( this . path . dirname ( dest ) ) ) ;
280
+ await this . vscfs . copy ( srcURI , destURI , {
281
281
overwrite : true
282
282
} ) ;
283
283
}
0 commit comments