提交 35068aec 编写于 作者: B Benjamin Pasero

Remove IFileService.readFolder (fixes #69330)

上级 e54f3d7e
......@@ -139,12 +139,6 @@ export interface IFileService {
*/
createFile(resource: URI, content?: string, options?: ICreateFileOptions): Promise<IFileStat>;
/**
* Reads a folder's content with the given path. The returned promise
* will have the list of children as a result.
*/
readFolder(resource: URI): Promise<string[]>;
/**
* Creates a new folder with the given path. The returned promise
* will have the stat model object as a result.
......@@ -1058,8 +1052,6 @@ export interface ILegacyFileService {
createFile(resource: URI, content?: string, options?: ICreateFileOptions): Promise<IFileStat>;
readFolder(resource: URI): Promise<string[]>;
del(resource: URI, options?: { useTrash?: boolean, recursive?: boolean }): Promise<void>;
watchFileChanges(resource: URI): void;
......
......@@ -783,8 +783,6 @@ export class SimpleRemoteFileService implements IFileService {
return Promise.resolve(createFile(parent, basename(_resource.path)));
}
readFolder(_resource: URI) { return Promise.resolve([]); }
createFolder(_resource: URI): Promise<IFileStat> {
const parent = fileMap.get(dirname(_resource));
if (!parent) {
......
......@@ -68,8 +68,10 @@ export class WelcomePageContribution implements IWorkbenchContribution {
if (openWithReadme) {
return Promise.all(contextService.getWorkspace().folders.map(folder => {
const folderUri = folder.uri;
return fileService.readFolder(folderUri)
.then(files => {
return fileService.resolveFile(folderUri)
.then(folder => {
const files = folder.children ? folder.children.map(child => child.name) : [];
const file = arrays.find(files.sort(), file => strings.startsWith(file.toLowerCase(), 'readme'));
if (file) {
return joinPath(folderUri, file);
......
......@@ -494,7 +494,8 @@ export class RemoteFileDialog {
const backDir = this.createBackItem(currentFolder);
try {
const fileNames = await this.fileService.readFolder(currentFolder);
const folder = await this.fileService.resolveFile(currentFolder);
const fileNames = folder.children ? folder.children.map(child => child.name) : [];
const items = await Promise.all(fileNames.map(fileName => this.createItem(fileName, currentFolder)));
for (let item of items) {
if (item) {
......
......@@ -756,12 +756,6 @@ export class FileService extends Disposable implements ILegacyFileService {
});
}
readFolder(resource: uri): Promise<string[]> {
const absolutePath = this.toAbsolutePath(resource);
return pfs.readdir(absolutePath);
}
private checkFileBeforeWriting(absolutePath: string, options: IUpdateContentOptions = Object.create(null), ignoreReadonly?: boolean): Promise<boolean /* exists */> {
return pfs.exists(absolutePath).then(exists => {
if (exists) {
......
......@@ -473,16 +473,6 @@ export class RemoteFileService extends FileService {
}
}
readFolder(resource: URI): Promise<string[]> {
if (resource.scheme === Schemas.file) {
return super.readFolder(resource);
} else {
return this._withProvider(resource).then(provider => {
return provider.readdir(resource);
}).then(list => list.map(l => l[0]));
}
}
moveFile(source: URI, target: URI, overwrite?: boolean): Promise<IFileStat> {
if (source.scheme !== target.scheme) {
return this._doMoveAcrossScheme(source, target);
......
......@@ -129,10 +129,6 @@ export class FileService2 extends Disposable implements IFileService {
//#region File Metadata Resolving
readFolder(resource: URI): Promise<string[]> {
return this._impl.readFolder(resource);
}
resolveFile(resource: URI, options?: IResolveFileOptions): Promise<IFileStat> {
return this._impl.resolveFile(resource, options);
}
......
......@@ -1005,10 +1005,6 @@ export class TestFileService implements IFileService {
throw new Error('not implemented');
}
readFolder(_resource: URI) {
return Promise.resolve([]);
}
createFolder(_resource: URI): Promise<IFileStat> {
throw new Error('not implemented');
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册