mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 04:53:33 +01:00
less bitmasks, replace FileOpenFlags with FileOptions, #47475
This commit is contained in:
@@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { FileOpenFlags, FileSystemProviderCapabilities, IFileChange, IFileService, IFileSystemProvider, IStat, IWatchOptions } from 'vs/platform/files/common/files';
|
||||
import { FileOptions, FileSystemProviderCapabilities, IFileChange, IFileService, IFileSystemProvider, IStat, IWatchOptions } from 'vs/platform/files/common/files';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { ExtHostContext, ExtHostFileSystemShape, IExtHostContext, IFileChangeDto, MainContext, MainThreadFileSystemShape } from '../node/extHost.protocol';
|
||||
|
||||
@@ -94,17 +94,17 @@ class RemoteFileSystemProvider implements IFileSystemProvider {
|
||||
});
|
||||
}
|
||||
|
||||
readFile(resource: URI, opts: { flags: FileOpenFlags }): TPromise<Uint8Array, any> {
|
||||
return this._proxy.$readFile(this._handle, resource, opts.flags).then(encoded => {
|
||||
readFile(resource: URI, opts: FileOptions): TPromise<Uint8Array, any> {
|
||||
return this._proxy.$readFile(this._handle, resource, opts).then(encoded => {
|
||||
return Buffer.from(encoded, 'base64');
|
||||
});
|
||||
}
|
||||
|
||||
writeFile(resource: URI, content: Uint8Array, opts: { flags: FileOpenFlags }): TPromise<void, any> {
|
||||
writeFile(resource: URI, content: Uint8Array, opts: FileOptions): TPromise<void, any> {
|
||||
let encoded = Buffer.isBuffer(content)
|
||||
? content.toString('base64')
|
||||
: Buffer.from(content.buffer, content.byteOffset, content.byteLength).toString('base64');
|
||||
return this._proxy.$writeFile(this._handle, resource, encoded, opts.flags);
|
||||
return this._proxy.$writeFile(this._handle, resource, encoded, opts);
|
||||
}
|
||||
|
||||
delete(resource: URI): TPromise<void, any> {
|
||||
@@ -119,11 +119,11 @@ class RemoteFileSystemProvider implements IFileSystemProvider {
|
||||
return this._proxy.$readdir(this._handle, resource);
|
||||
}
|
||||
|
||||
rename(resource: URI, target: URI, opts: { flags: FileOpenFlags }): TPromise<IStat, any> {
|
||||
return this._proxy.$rename(this._handle, resource, target, opts.flags);
|
||||
rename(resource: URI, target: URI, opts: FileOptions): TPromise<IStat, any> {
|
||||
return this._proxy.$rename(this._handle, resource, target, opts);
|
||||
}
|
||||
|
||||
copy(resource: URI, target: URI, opts: { flags: FileOpenFlags }): TPromise<IStat, any> {
|
||||
return this._proxy.$copy(this._handle, resource, target, opts.flags);
|
||||
copy(resource: URI, target: URI, opts: FileOptions): TPromise<IStat, any> {
|
||||
return this._proxy.$copy(this._handle, resource, target, opts);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user