Skip to content

Conversation

Plamen5kov
Copy link
Contributor

Runtime deletes unnecessary folders on livesync

problem
When CLI livesyncs, android runtime needs to remove old files and it does, but it leaves empty folders

solution
check if folders are empty on exit and delete if so

@ns-bot
Copy link

ns-bot commented Aug 9, 2017

💚

@Plamen5kov Plamen5kov requested a review from petekanev August 9, 2017 11:56
targetFile.delete();
} else {
deleteRemovedFiles(file, sourceRootAbsolutePath, targetRootAbsolutePath);
if (targetFile.listFiles().length == 0) {
Copy link
Contributor

@petekanev petekanev Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment why that is necessary?

Copy link
Contributor Author

@Plamen5kov Plamen5kov Aug 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It cleans the empty folders after it's done deleting files.
It's not necessary, I just did it so we don't pollute the device with empty folders. Plus to keep behavior the same as on iOS devices.
I'll comment it in the code no problem.

@ns-bot
Copy link

ns-bot commented Aug 10, 2017

💚

} else {
deleteRemovedFiles(file, sourceRootAbsolutePath, targetRootAbsolutePath);

// this is done so empty folders, if any, are deleted after we're don deleting files.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is only present in the test-app class. Could you do the same for the build template?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F!@@#%!%$!@#

@Plamen5kov Plamen5kov self-assigned this Aug 10, 2017
@ns-bot
Copy link

ns-bot commented Aug 10, 2017

💚

@Plamen5kov Plamen5kov merged commit 05aa179 into master Aug 11, 2017
@Plamen5kov Plamen5kov deleted the plamen5kov/delete-empty-folders-on-exit branch August 11, 2017 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants