Skip to content

Files written to the file-system are lost after update #20

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

Closed
shiv19 opened this issue Jul 3, 2019 · 8 comments
Closed

Files written to the file-system are lost after update #20

shiv19 opened this issue Jul 3, 2019 · 8 comments
Assignees
Milestone

Comments

@shiv19
Copy link
Member

shiv19 commented Jul 3, 2019

We noticed that after an AppSync update, the files that the app writes to the file system are lost.
However, things stored in App-Settings remain intact.

@EddyVerbruggen
Copy link
Contributor

Hmm, interesting one. Can you tell me how you wrote to the fs (a snippet would be helpful) and which platforms are affected?

@shiv19
Copy link
Member Author

shiv19 commented Jul 5, 2019

import { knownFolders } from 'tns-core-modules/file-system';
const documents = knownFolders.documents();
const jsonFile = documents.getFile('/app/something.json');
jsonFile.readText().then(function(content) {}); // for read
jsonFile.writeText(text).then(function() {}); // for write

Something like this. And I realize that files are being written into app folder in this app.

@shiv19
Copy link
Member Author

shiv19 commented Jul 5, 2019

@EddyVerbruggen I believe this affects both Android and iOS since the files are in app folder.
But I haven't tested it on iOS

@EddyVerbruggen
Copy link
Contributor

EddyVerbruggen commented Jul 7, 2019

Thanks for the snippet. Looking at this today and reporting my findings here. Note that an iOS sim and device behave differently, so that's why I'll test both of those separately.

  • iOS Simulator ✅
  • iOS Device ✅(so iOS seems fine)
  • Android Device ❌(I can confirm the issue)

@EddyVerbruggen
Copy link
Contributor

Hey @shiv19, can you please give version 1.0.2 a try?

On Android (only) I used to rename the /app folder to /app_backup and then rename the folder with the pending update to /app. So that's why files saved to /app were lost. I guess if you save to different folders there wouldn't be an issue.

I've now updated the algorithm to instead copy the new files over the current /app folder, so anything already there won't be removed.

@shiv19
Copy link
Member Author

shiv19 commented Jul 7, 2019

Thanks @EddyVerbruggen
I'll give it a try today :)

@shiv19
Copy link
Member Author

shiv19 commented Jul 7, 2019

@EddyVerbruggen It worked! :D Thank you

@EddyVerbruggen
Copy link
Contributor

Woohoo, thx for testing this!

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

No branches or pull requests

2 participants