Skip to content

Commit

Permalink
add open flags to rename, #47475
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Apr 13, 2018
1 parent 423ec88 commit d4bed9b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/vs/platform/files/common/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export interface IStat {
export interface IFileSystemProviderBase {
onDidChange: Event<IFileChange[]>;
stat(resource: URI): TPromise<IStat>;
rename(from: URI, to: URI): TPromise<IStat>;
rename(from: URI, to: URI, opts: { flags: FileOpenFlags }): TPromise<IStat>;
mkdir(resource: URI): TPromise<IStat>;
readdir(resource: URI): TPromise<[string, IStat][]>;
delete(resource: URI): TPromise<void>;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ declare module 'vscode' {
* @param newUri The target location
* @param token A cancellation token.
*/
rename(oldUri: Uri, newUri: Uri, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
rename(oldUri: Uri, newUri: Uri, options: { flags: FileOpenFlags }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;

// todo@remote
// helps with performance bigly
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class RemoteFileSystemProvider implements ISimpleReadWriteProvider, IFileSystemP
delete(resource: URI): TPromise<void, any> {
return this._proxy.$delete(this._handle, resource);
}
rename(resource: URI, target: URI): TPromise<IStat, any> {
return this._proxy.$move(this._handle, resource, target);
rename(resource: URI, target: URI, opts: { flags: FileOpenFlags }): TPromise<IStat, any> {
return this._proxy.$rename(this._handle, resource, target, opts.flags);
}
mkdir(resource: URI): TPromise<IStat, any> {
return this._proxy.$mkdir(this._handle, resource);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/node/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ export interface ExtHostFileSystemShape {
$readFile(handle: number, resource: UriComponents, flags: FileOpenFlags): TPromise<string>;
$writeFile(handle: number, resource: UriComponents, base64Encoded: string, flags: FileOpenFlags): TPromise<void>;

$move(handle: number, resource: UriComponents, target: UriComponents): TPromise<IStat>;
$rename(handle: number, resource: UriComponents, target: UriComponents, flags: FileOpenFlags): TPromise<IStat>;
$mkdir(handle: number, resource: UriComponents): TPromise<IStat>;
$readdir(handle: number, resource: UriComponents): TPromise<[string, IStat][]>;

Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/node/extHostFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
$delete(handle: number, resource: UriComponents): TPromise<void, any> {
return asWinJsPromise(token => this._fsProvider.get(handle).delete(URI.revive(resource), token));
}
$move(handle: number, oldUri: UriComponents, newUri: UriComponents): TPromise<files.IStat, any> {
return asWinJsPromise(token => this._fsProvider.get(handle).rename(URI.revive(oldUri), URI.revive(newUri), token));
$rename(handle: number, oldUri: UriComponents, newUri: UriComponents, flags: files.FileOpenFlags): TPromise<files.IStat, any> {
return asWinJsPromise(token => this._fsProvider.get(handle).rename(URI.revive(oldUri), URI.revive(newUri), { flags }, token));
}
$mkdir(handle: number, resource: UriComponents): TPromise<files.IStat, any> {
return asWinJsPromise(token => this._fsProvider.get(handle).create(URI.revive(resource), { type: FileType2.Directory }, token));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export class RemoteFileService extends FileService {
: TPromise.as(null);

return prepare.then(() => this._withProvider(source)).then(provider => {
return provider.rename(source, target).then(stat => {
return provider.rename(source, target, { flags: 0 /*todo@remote -> RENAME_NOREPLACE */ }).then(stat => {
return toIFileStat(provider, [target, stat]);
}).then(fileStat => {
this._onAfterOperation.fire(new FileOperationEvent(source, FileOperation.MOVE, fileStat));
Expand Down

0 comments on commit d4bed9b

Please sign in to comment.