Skip to content

Commit 3692d8b

Browse files
committed
add dir check, modified file check
1 parent d7f06d2 commit 3692d8b

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib/services/project-changes-service.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ export class ProjectChangesService implements IProjectChangesService {
4747
constructor(
4848
private $platformsData: IPlatformsData,
4949
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
50-
private $fs: IFileSystem,
51-
private $hostInfo: IHostInfo) {
50+
private $fs: IFileSystem) {
5251
}
5352

5453
public get currentChanges(): IProjectChangesInfo {
@@ -69,6 +68,7 @@ export class ProjectChangesService implements IProjectChangesService {
6968
path.join(projectData.projectDir, NODE_MODULES_FOLDER_NAME, "tns-ios-inspector"),
7069
projectData,
7170
this.fileChangeRequiresBuild);
71+
7272
if (this._newFiles > 0) {
7373
this._changesInfo.modulesChanged = true;
7474
}
@@ -231,14 +231,6 @@ export class ProjectChangesService implements IProjectChangesService {
231231
let changed = fileStats.mtime.getTime() > this._outputProjectMtime ||
232232
fileStats.ctime.getTime() >= this._outputProjectCTime;
233233

234-
if (this.$hostInfo.isDarwin && !fileStats.isDirectory() && !changed) {
235-
const parentDirPath: string = path.dirname(filePath);
236-
const parentDirStat = this.$fs.getFsStats(parentDirPath);
237-
238-
changed = parentDirStat.mtime.getTime() > this._outputProjectMtime ||
239-
parentDirStat.ctime.getTime() >= this._outputProjectCTime;
240-
}
241-
242234
if (changed) {
243235
if (processFunc) {
244236
this._newFiles++;
@@ -252,14 +244,25 @@ export class ProjectChangesService implements IProjectChangesService {
252244
}
253245

254246
if (fileStats.isDirectory()) {
247+
if (this.isDirectoryModified(dir)) {
248+
return true;
249+
}
250+
255251
if (this.containsNewerFiles(filePath, skipDir, projectData, processFunc)) {
256252
return true;
257253
}
258254
}
255+
259256
}
260257
return false;
261258
}
262259

260+
private isDirectoryModified(dirPath: string): boolean {
261+
const dirPathStat = this.$fs.getFsStats(dirPath);
262+
return dirPathStat.mtime.getTime() > this._outputProjectMtime ||
263+
dirPathStat.ctime.getTime() >= this._outputProjectCTime;
264+
}
265+
263266
private fileChangeRequiresBuild(file: string, projectData: IProjectData) {
264267
if (path.basename(file) === "package.json") {
265268
return true;

0 commit comments

Comments
 (0)