Skip to content

move app dir to <private_dir>/app allowing for re-installation/upda…#852

Merged
inclement merged 1 commit into
masterfrom
fix_recursive_delete
Jul 30, 2016
Merged

move app dir to <private_dir>/app allowing for re-installation/upda…#852
inclement merged 1 commit into
masterfrom
fix_recursive_delete

Conversation

@akshayaurora

@akshayaurora akshayaurora commented Jul 25, 2016

Copy link
Copy Markdown
Member

…tion to not delete the user data.

This is only working for sdl2 bootstrap, still need to test with service and other bootstraps.

This is based on #350

We need to have the following fix in kivy with this pr. kivy/kivy#4490

…tion to not delete the user data.

This is only working for sdl2 bootstrap, stiil need to test with service and other bootstraps.
@inclement

Copy link
Copy Markdown
Member

Great. I'll check it at the weekend if it can wait a couple more days.

private Bundle mMetaData = null;
private PowerManager.WakeLock mWakeLock = null;

public String getKivyRoot() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might be nice to use getAppRoot or something instead of Kivy, but it doesn't really matter.

@ecdsa

ecdsa commented Jul 28, 2016

Copy link
Copy Markdown

Thank you!

@brussee

brussee commented Jul 29, 2016

Copy link
Copy Markdown
Contributor

I solved this by putting the user data in a different folder.
I agree putting the p4a files into a different folder would be better. However I think this should not be a subfolder of /files because the user can clear the files and essentially the p4a files are app src code, not data files.
The same goes for the libs. There is a separate data folder on Android to store app libs, also private afaik.

@akshayaurora

akshayaurora commented Jul 29, 2016

Copy link
Copy Markdown
Member Author

However I think this should not be a subfolder of /files because the user can clear the files

The default behavior should be to allow the user to delete the private data if he want's to.
If the app developer want's the data to survive, then they are free to use a custom dir just like you did, no?

@brussee

brussee commented Jul 30, 2016

Copy link
Copy Markdown
Contributor

The default behavior should be to allow the user the private data if he want's to.

Yes, I agree, but I consider the p4a private files not to be user data, so I would put those in a different folder.
So, in my case I should swap the folders: put the user data back in the files directory and the p4a private files in another, outside of the files directory that is currently in use by the p4a private files.

@akshayaurora

akshayaurora commented Jul 30, 2016

Copy link
Copy Markdown
Member Author

So, in my case I should swap the folders: put the user data back in the files directory and the p4a private files in another, outside of the files directory that is currently in use by the p4a private files.

So currently with this pr, <private_dir>/files is where user can put their data (create a <private_dir>/files/data folder if they want to.) The app sources and files goto <private_dir>/files/app libs reside in <private_dir>/files/app/libs

Only the files/apps folder is deleted when we need to update the app.

p4a app files are not with the data.

@brussee

brussee commented Jul 30, 2016

Copy link
Copy Markdown
Contributor

I just tested it and everything in the private dir is deleted if the user presses the "Clear data" button. So my assumption was incorrect: I thought only the /files contents would be deleted by that.
The conclusion is that it really doesn't matter where the p4a private dir and libs are located, they all are lost.

@akshayaurora

Copy link
Copy Markdown
Member Author

The conclusion is that it really doesn't matter where the p4a private dir and libs are located, they all are lost.

Yup, and that's how it should be, if the dev wants to prevent this behavior then they should choose a separate dir manually like /sdcard/ but issue with that would be it is not protected/private by the os the developer may have to manage that themselves..

/* If we built our own python, set up the paths correctly */
LOGP("Setting up python from ANDROID_PRIVATE");
PyRun_SimpleString("private = posix.environ['ANDROID_PRIVATE']\n"
PyRun_SimpleString("private = posix.environ['ANDROID_PRIVATE'] + '/app'\n"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should actually use ANDROID_APP_PATH rather than guessing /app, right? If that's right, just let me know and I'll make the change manually and merge.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

@inclement inclement merged commit ea17bcb into master Jul 30, 2016
@akshayaurora akshayaurora deleted the fix_recursive_delete branch July 30, 2016 20:48
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.

4 participants