mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Use original-fs instead of manually ignoring ASAR files (fixes #8470)
This commit is contained in:
@@ -50,7 +50,7 @@ export interface IFileServiceOptions {
|
||||
debugBrkFileWatcherPort?: number;
|
||||
}
|
||||
|
||||
function etag(stat: extfs.IRawStat): string;
|
||||
function etag(stat: fs.Stats): string;
|
||||
function etag(size: number, mtime: number): string;
|
||||
function etag(arg1: any, arg2?: any): string {
|
||||
let size: number;
|
||||
@@ -59,8 +59,8 @@ function etag(arg1: any, arg2?: any): string {
|
||||
size = arg1;
|
||||
mtime = arg2;
|
||||
} else {
|
||||
size = (<extfs.IRawStat>arg1).size;
|
||||
mtime = (<extfs.IRawStat>arg1).mtime.getTime();
|
||||
size = (<fs.Stats>arg1).size;
|
||||
mtime = (<fs.Stats>arg1).mtime.getTime();
|
||||
}
|
||||
|
||||
return '"' + crypto.createHash('sha1').update(String(size) + String(mtime)).digest('hex') + '"';
|
||||
@@ -424,7 +424,7 @@ export class FileService implements IFileService {
|
||||
private toStatResolver(resource: uri): TPromise<StatResolver> {
|
||||
let absolutePath = this.toAbsolutePath(resource);
|
||||
|
||||
return pfs.stat(absolutePath).then((stat: extfs.IRawStat) => {
|
||||
return pfs.stat(absolutePath).then((stat: fs.Stats) => {
|
||||
return new StatResolver(resource, stat.isDirectory(), stat.mtime.getTime(), stat.size, this.options.verboseLogging);
|
||||
});
|
||||
}
|
||||
@@ -528,7 +528,7 @@ export class FileService implements IFileService {
|
||||
private checkFile(absolutePath: string, options: IUpdateContentOptions): TPromise<boolean /* exists */> {
|
||||
return pfs.exists(absolutePath).then((exists) => {
|
||||
if (exists) {
|
||||
return pfs.stat(absolutePath).then((stat: extfs.IRawStat) => {
|
||||
return pfs.stat(absolutePath).then((stat: fs.Stats) => {
|
||||
if (stat.isDirectory()) {
|
||||
return TPromise.wrapError(new Error('Expected file is actually a directory'));
|
||||
}
|
||||
@@ -723,7 +723,7 @@ export class StatResolver {
|
||||
// for each file in the folder
|
||||
flow.parallel(files, (file: string, clb: (error: Error, children: IFileStat) => void) => {
|
||||
let fileResource = uri.file(paths.resolve(absolutePath, file));
|
||||
let fileStat: extfs.IRawStat;
|
||||
let fileStat: fs.Stats;
|
||||
let $this = this;
|
||||
|
||||
flow.sequence(
|
||||
@@ -736,10 +736,10 @@ export class StatResolver {
|
||||
},
|
||||
|
||||
function stat(): void {
|
||||
extfs.stat(fileResource.fsPath, this);
|
||||
fs.stat(fileResource.fsPath, this);
|
||||
},
|
||||
|
||||
function countChildren(fsstat: extfs.IRawStat): void {
|
||||
function countChildren(fsstat: fs.Stats): void {
|
||||
fileStat = fsstat;
|
||||
|
||||
if (fileStat.isDirectory()) {
|
||||
|
||||
@@ -116,7 +116,7 @@ export class FileWalker {
|
||||
return clb(false);
|
||||
}
|
||||
|
||||
return extfs.stat(this.filePattern, (error, stat) => {
|
||||
return fs.stat(this.filePattern, (error, stat) => {
|
||||
return clb(!error && !stat.isDirectory(), stat && stat.size); // only existing files
|
||||
});
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export class FileWalker {
|
||||
|
||||
const absolutePath = paths.join(basePath, this.filePattern);
|
||||
|
||||
return extfs.stat(absolutePath, (error, stat) => {
|
||||
return fs.stat(absolutePath, (error, stat) => {
|
||||
return clb(!error && !stat.isDirectory() ? absolutePath : null, stat && stat.size); // only existing files
|
||||
});
|
||||
}
|
||||
@@ -159,12 +159,12 @@ export class FileWalker {
|
||||
|
||||
// Use lstat to detect links
|
||||
let currentAbsolutePath = [absolutePath, file].join(paths.sep);
|
||||
extfs.lstat(currentAbsolutePath, (error, lstat) => {
|
||||
fs.lstat(currentAbsolutePath, (error, lstat) => {
|
||||
if (error || this.isCanceled || this.isLimitHit) {
|
||||
return clb(null);
|
||||
}
|
||||
|
||||
// If the path is a link, we must instead use extfs.stat() to find out if the
|
||||
// If the path is a link, we must instead use fs.stat() to find out if the
|
||||
// link is a directory or not because lstat will always return the stat of
|
||||
// the link which is always a file.
|
||||
this.statLinkIfNeeded(currentAbsolutePath, lstat, (error, stat) => {
|
||||
@@ -255,15 +255,15 @@ export class FileWalker {
|
||||
return true;
|
||||
}
|
||||
|
||||
private statLinkIfNeeded(path: string, lstat: extfs.IRawStat, clb: (error: Error, stat: extfs.IRawStat) => void): void {
|
||||
private statLinkIfNeeded(path: string, lstat: fs.Stats, clb: (error: Error, stat: fs.Stats) => void): void {
|
||||
if (lstat.isSymbolicLink()) {
|
||||
return extfs.stat(path, clb); // stat the target the link points to
|
||||
return fs.stat(path, clb); // stat the target the link points to
|
||||
}
|
||||
|
||||
return clb(null, lstat); // not a link, so the stat is already ok for us
|
||||
}
|
||||
|
||||
private realPathIfNeeded(path: string, lstat: extfs.IRawStat, clb: (error: Error, realpath?: string) => void): void {
|
||||
private realPathIfNeeded(path: string, lstat: fs.Stats, clb: (error: Error, realpath?: string) => void): void {
|
||||
if (lstat.isSymbolicLink()) {
|
||||
return fs.realpath(path, (error, realpath) => {
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user