Skip to content

Commit b7be851

Browse files
Use sync version of fs.getFsStats
1 parent 6e698e9 commit b7be851

File tree

8 files changed

+16
-15
lines changed

8 files changed

+16
-15
lines changed

lib/services/android-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
357357
this.$fs.ensureDirectoryExists(resourcesDestinationDirectoryPath).wait();
358358
shell.cp("-Rf", path.join(pluginPlatformsFolderPath, "*"), resourcesDestinationDirectoryPath);
359359

360-
(this.$fs.enumerateFilesInDirectorySync(resourcesDestinationDirectoryPath, file => this.$fs.getFsStats(file).wait().isDirectory() || path.extname(file) === constants.XML_FILE_EXTENSION) || [])
360+
(this.$fs.enumerateFilesInDirectorySync(resourcesDestinationDirectoryPath, file => this.$fs.getFsStats(file).isDirectory() || path.extname(file) === constants.XML_FILE_EXTENSION) || [])
361361
.forEach(file => {
362362
this.$logger.trace(`Interpolate data for plugin file: ${file}`);
363363
this.$pluginVariablesService.interpolate(pluginData, file).wait();

lib/services/app-files-updater.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ export class AppFilesUpdater {
7878
protected copyAppSourceFiles(sourceFiles: string[]): void {
7979
let copyFileFutures = sourceFiles.map(source => {
8080
let destinationPath = path.join(this.appDestinationDirectoryPath, path.relative(this.appSourceDirectoryPath, source));
81-
let exists = fs.lstatSync(source);
82-
if (exists.isSymbolicLink()) {
81+
82+
let exists = fs.lstatSync(source);
83+
if (exists.isSymbolicLink()) {
8384
source = fs.realpathSync(source);
84-
exists = fs.lstatSync(source);
85-
}
85+
exists = fs.lstatSync(source);
86+
}
8687
if (exists.isDirectory()) {
8788
return this.fs.createDirectory(destinationPath);
8889
}

lib/services/ios-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
926926
}
927927

928928
private generateModulemap(headersFolderPath: string, libraryName: string): void {
929-
let headersFilter = (fileName: string, containingFolderPath: string) => (path.extname(fileName) === ".h" && this.$fs.getFsStats(path.join(containingFolderPath, fileName)).wait().isFile());
929+
let headersFilter = (fileName: string, containingFolderPath: string) => (path.extname(fileName) === ".h" && this.$fs.getFsStats(path.join(containingFolderPath, fileName)).isFile());
930930
let headersFolderContents = this.$fs.readDirectory(headersFolderPath).wait();
931931
let headers = _(headersFolderContents).filter(item => headersFilter(item, headersFolderPath)).value();
932932

lib/services/livesync/platform-livesync-service-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
3838
return;
3939
}
4040

41-
let fileHash = this.$fs.exists(filePath) && this.$fs.getFsStats(filePath).wait().isFile() ? this.$fs.getFileShasum(filePath).wait() : "";
41+
let fileHash = this.$fs.exists(filePath) && this.$fs.getFsStats(filePath).isFile() ? this.$fs.getFileShasum(filePath).wait() : "";
4242
if (fileHash === this.fileHashes[filePath]) {
4343
this.$logger.trace(`Skipping livesync for ${filePath} file with ${fileHash} hash.`);
4444
return;

lib/services/platform-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export class PlatformService implements IPlatformService {
301301
return (() => {
302302
let platformData = this.$platformsData.getPlatformData(platform);
303303
let appDestinationDirectoryPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
304-
let lastModifiedTime = this.$fs.exists(appDestinationDirectoryPath) ? this.$fs.getFsStats(appDestinationDirectoryPath).wait().mtime : null;
304+
let lastModifiedTime = this.$fs.exists(appDestinationDirectoryPath) ? this.$fs.getFsStats(appDestinationDirectoryPath).mtime : null;
305305

306306
try {
307307
let tnsModulesDestinationPath = path.join(appDestinationDirectoryPath, constants.TNS_MODULES_FOLDER_NAME);
@@ -387,7 +387,7 @@ export class PlatformService implements IPlatformService {
387387

388388
this.$fs.ensureDirectoryExists(path.dirname(targetPath)).wait();
389389

390-
if (this.$fs.exists(targetPath) && this.$fs.getFsStats(targetPath).wait().isDirectory()) {
390+
if (this.$fs.exists(targetPath) && this.$fs.getFsStats(targetPath).isDirectory()) {
391391
let sourceFileName = path.basename(packageFile);
392392
this.$logger.trace(`Specified target path: '${targetPath}' is directory. Same filename will be used: '${sourceFileName}'.`);
393393
targetPath = path.join(targetPath, sourceFileName);
@@ -574,7 +574,7 @@ export class PlatformService implements IPlatformService {
574574

575575
return {
576576
packageName: currentPackage,
577-
time: this.$fs.getFsStats(currentPackage).wait().mtime
577+
time: this.$fs.getFsStats(currentPackage).mtime
578578
};
579579
});
580580

lib/services/project-changes-info.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class ProjectChangesInfo {
3939
this.configChanged = true;
4040
this.prepareInfo = { time: "", bundle: $options.bundle, release: $options.release };
4141
} else {
42-
let outputProjectMtime = this.$fs.getFsStats(buildInfoFile).wait().mtime.getTime();
42+
let outputProjectMtime = this.$fs.getFsStats(buildInfoFile).mtime.getTime();
4343
this.prepareInfo = this.$fs.readJson(buildInfoFile).wait();
4444
this.appFilesChanged = this.containsNewerFiles(this.$projectData.appDirectoryPath, this.$projectData.appResourcesDirectoryPath, outputProjectMtime);
4545
if (!skipModulesAndResources) {
@@ -82,7 +82,7 @@ export class ProjectChangesInfo {
8282
private filesChanged(files: string[], mtime: number): boolean {
8383
for (let file of files) {
8484
if (this.$fs.exists(file)) {
85-
let fileStats = this.$fs.getFsStats(file).wait();
85+
let fileStats = this.$fs.getFsStats(file);
8686
if (fileStats.mtime.getTime() > mtime) {
8787
return true;
8888
}
@@ -98,7 +98,7 @@ export class ProjectChangesInfo {
9898
if (filePath === skipDir) {
9999
continue;
100100
}
101-
let fileStats = this.$fs.getFsStats(filePath).wait();
101+
let fileStats = this.$fs.getFsStats(filePath);
102102
if (fileStats.mtime.getTime() > mtime) {
103103
return true;
104104
}

lib/tools/node-modules/node-modules-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class NodeModulesBuilder implements INodeModulesBuilder {
5656
relativePath = path.relative(projectDir, resolvedPath);
5757
let stat = match.statCache[resolvedPath] || match.statCache[relativePath];
5858
if (!stat) {
59-
match.statCache[resolvedPath] = stat = this.$fs.getFsStats(resolvedPath).wait();
59+
match.statCache[resolvedPath] = stat = this.$fs.getFsStats(resolvedPath);
6060
}
6161

6262
if (stat.mtime <= lastModifiedTime) {

test/stubs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class FileSystemStub implements IFileSystem {
118118
return undefined;
119119
}
120120

121-
getFsStats(path: string): IFuture<IFsStats> {
121+
getFsStats(path: string): IFsStats {
122122
return undefined;
123123
}
124124

0 commit comments

Comments
 (0)