-
-
Notifications
You must be signed in to change notification settings - Fork 197
make livesync work with renamed files and folders #3042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
94eeebb
d7f06d2
3692d8b
c861d06
3b8cb02
3c2713c
9020a86
f99697d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ export class ProjectChangesService implements IProjectChangesService { | |
path.join(projectData.projectDir, NODE_MODULES_FOLDER_NAME, "tns-ios-inspector"), | ||
projectData, | ||
this.fileChangeRequiresBuild); | ||
|
||
if (this._newFiles > 0) { | ||
this._changesInfo.modulesChanged = true; | ||
} | ||
|
@@ -218,19 +219,23 @@ export class ProjectChangesService implements IProjectChangesService { | |
} | ||
|
||
private containsNewerFiles(dir: string, skipDir: string, projectData: IProjectData, processFunc?: (filePath: string, projectData: IProjectData) => boolean): boolean { | ||
const dirFileStat = this.$fs.getFsStats(dir); | ||
if (this.isFileModified(dirFileStat)) { | ||
return true; | ||
} | ||
|
||
let files = this.$fs.readDirectory(dir); | ||
for (let file of files) { | ||
let filePath = path.join(dir, file); | ||
if (filePath === skipDir) { | ||
continue; | ||
} | ||
|
||
let fileStats = this.$fs.getFsStats(filePath); | ||
|
||
let changed = fileStats.mtime.getTime() >= this._outputProjectMtime || fileStats.ctime.getTime() >= this._outputProjectCTime; | ||
const fileStats = this.$fs.getFsStats(filePath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the
Here we are doing the same:
I suggest passing only the path to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used here |
||
let changed = this.isFileModified(fileStats); | ||
if (!changed) { | ||
let lFileStats = this.$fs.getLsStats(filePath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this code deleted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's unnecessary to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ping @Plamen5kov There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will bring back the code, so we continue working with synlinked files. |
||
changed = lFileStats.mtime.getTime() >= this._outputProjectMtime || lFileStats.ctime.getTime() >= this._outputProjectCTime; | ||
changed = this.isFileModified(lFileStats); | ||
} | ||
|
||
if (changed) { | ||
|
@@ -250,10 +255,16 @@ export class ProjectChangesService implements IProjectChangesService { | |
return true; | ||
} | ||
} | ||
|
||
} | ||
return false; | ||
} | ||
|
||
private isFileModified(filePathStat: IFsStats): boolean { | ||
return filePathStat.mtime.getTime() >= this._outputProjectMtime || | ||
filePathStat.ctime.getTime() >= this._outputProjectCTime; | ||
} | ||
|
||
private fileChangeRequiresBuild(file: string, projectData: IProjectData) { | ||
if (path.basename(file) === "package.json") { | ||
return true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the lstat of the dir has been changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted, I don't know how I missed that!