mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
use isFile-info instead of defaulting to FileType.File, fixes #84524
This commit is contained in:
@@ -55,7 +55,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
|
||||
ctime: stat.ctime,
|
||||
mtime: stat.mtime,
|
||||
size: stat.size,
|
||||
type: MainThreadFileSystem._getFileType(stat)
|
||||
type: MainThreadFileSystem._asFileType(stat)
|
||||
};
|
||||
}).catch(MainThreadFileSystem._handleError);
|
||||
}
|
||||
@@ -67,12 +67,22 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
|
||||
err.name = FileSystemProviderErrorCode.FileNotADirectory;
|
||||
throw err;
|
||||
}
|
||||
return !stat.children ? [] : stat.children.map(child => [child.name, MainThreadFileSystem._getFileType(child)] as [string, FileType]);
|
||||
return !stat.children ? [] : stat.children.map(child => [child.name, MainThreadFileSystem._asFileType(child)] as [string, FileType]);
|
||||
}).catch(MainThreadFileSystem._handleError);
|
||||
}
|
||||
|
||||
private static _getFileType(stat: IFileStat): FileType {
|
||||
return (stat.isDirectory ? FileType.Directory : FileType.File) + (stat.isSymbolicLink ? FileType.SymbolicLink : 0);
|
||||
private static _asFileType(stat: IFileStat): FileType {
|
||||
let res = 0;
|
||||
if (stat.isFile) {
|
||||
res += FileType.File;
|
||||
|
||||
} else if (stat.isDirectory) {
|
||||
res += FileType.Directory;
|
||||
}
|
||||
if (stat.isSymbolicLink) {
|
||||
res += FileType.SymbolicLink;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
$readFile(uri: UriComponents): Promise<VSBuffer> {
|
||||
|
||||
Reference in New Issue
Block a user