Pull Request sent: https://github.com/apache/cordova-plugin-file/pull/127
Simon Mac Donald http://hi.im/simonmacdonald On Mon, Jul 27, 2015 at 10:55 AM, Simon MacDonald <simon.macdon...@gmail.com > wrote: > kk, I think this has enough support and I'll end up putting together a > pull request today. > > > Simon Mac Donald > http://hi.im/simonmacdonald > > On Mon, Jul 27, 2015 at 10:40 AM, Andrew Grieve <agri...@chromium.org> > wrote: > >> Ian and I made the switch to internal (via the preference). >> >> - I thought at one point the default app template set the preference to >> internal, so that new apps would get the better behaviour and existing >> apps >> would continue to work. I don't see this happening now though :( >> - The duplicate files/files, although oddly names, was just meant to give >> the HTML5 FS root a directory that isolated from the rest of the app's >> internal storage (so that it doesn't conflict with files put there by >> plugins) >> >> Anyways, +1 for just switching this default and bumping the version. >> >> On Wed, Jul 22, 2015 at 9:27 PM, Carlos Santana <csantan...@gmail.com> >> wrote: >> >> > ding ding ding we have a winner , Are the blackberry guys still around >> on >> > this mailing list by the way? >> > On Wed, Jul 22, 2015 at 10:00 PM Simon MacDonald < >> > simon.macdon...@gmail.com> >> > wrote: >> > >> > > As near as I can tell Windows use internal private storage as well. >> > > >> > > Simon Mac Donald >> > > http://hi.im/simonmacdonald >> > > >> > > On Wed, Jul 22, 2015 at 5:32 PM, Carlos Santana <csantan...@gmail.com >> > >> > > wrote: >> > > >> > > > I think cross platform web developers would expect all platforms to >> > have >> > > > same default. What the default for windows? >> > > > >> > > > +1 make default internal at least will have iOS and android with >> same >> > > > expectations >> > > > >> > > > We need to change the Major number (sever) for the version, it feels >> > like >> > > > is changing an API >> > > > >> > > > I like the explicit even if it's not needed because the default is >> > > > internal. But if they see it there it reminds them that internal is >> > being >> > > > used. >> > > > On Wed, Jul 22, 2015 at 4:02 PM Darryl Pogue <dar...@dpogue.ca> >> wrote: >> > > > >> > > > > +1 because saving to the SD Card has added problems with other >> apps >> > > (such >> > > > > as photo and music apps) picking up files that they shouldn't. >> > > > > >> > > > > Nothing more annoying than accidentally unleashing 200 logos and >> > icons >> > > > into >> > > > > the photos app of unsuspecting users. >> > > > > >> > > > > On 22 July 2015 at 12:47, Simon MacDonald < >> simon.macdon...@gmail.com >> >> > > >> > > > > wrote: >> > > > > >> > > > > > *TL;DR Summary* >> > > > > > >> > > > > > We should switch the default for the Cordova Android File >> System to >> > > be >> > > > on >> > > > > > internal storage, not the SD Card (or emulated SD card). >> > > > > > >> > > > > > >> > > > > > *Long Version* >> > > > > > >> > > > > > Currently in Cordova Android when you use this code "window. >> > > > > > requestFileSystem(PERSISTENT, 0, win, fail);" the root file >> system >> > > path >> > > > > > that is returned is "/storage/emulated/0" i.e. "/sdcard". >> > > > > > >> > > > > > Why you may ask? Because back in 2010 or so Bryce Curtis and I >> > argued >> > > > > that >> > > > > > we should use the external storage location because internal >> > storage >> > > > was >> > > > > > not very large on Android 2.x and we didn't want to have >> developers >> > > > > filling >> > > > > > up the devices limited internal storage. Joe Bowser argued >> against >> > it >> > > > > > because of issues with the SD Card on Android but was eventually >> > out >> > > > > voted. >> > > > > > >> > > > > > Now, I'm prepared to admit that Bryce was wrong (see what I did >> > > > there?). >> > > > > I >> > > > > > feel that the default behaviour for >> > > > "window.requestFileSystem(PERSISTENT, >> > > > > > 0, win, fail);" should be to resolve to a location on internal >> > > storage >> > > > > that >> > > > > > meets the following requirements: >> > > > > > >> > > > > > a) private to the application >> > > > > > >> > > > > > b) removed when the application is uninstalled >> > > > > > >> > > > > > c) lines up with what we have on iOS and WP >> > > > > > >> > > > > > In fact you can get this behaviour right now but setting the >> > > following >> > > > > > preference in config.xml: >> > > > > > >> > > > > > <preference name="AndroidPersistentFileLocation" >> value="Internal" >> > /> >> > > > > > >> > > > > > This gets you a root file path of "/data/data/<android >> > > > > > package>/files/files/". The double "files" is an issue but we >> can >> > > > > probably >> > > > > > ignore it for now. >> > > > > > >> > > > > > If a user wants the old behaviour they only need to make the >> > > > preference: >> > > > > > >> > > > > > <preference name="AndroidPersistentFileLocation" >> > > value="Compatibility" >> > > > /> >> > > > > > >> > > > > > and the original behaviour will be retained. >> > > > > > >> > > > > > What I'm advocating for is to make internal storage the default >> > > > behaviour >> > > > > > for Cordova Android. >> > > > > > >> > > > > > >> > > > > > *Code Changes* >> > > > > > >> > > > > > I've already taken a brief look into this and I feel the change >> is >> > > > > > extremely minor. We need only change the default return value >> from >> > > > > > "compatibility" to "internal" at line 156 of FileUtils.java ( >> > > > > > https://github >> > > > > > >> > > > > >> > > > >> > > >> > >> .com/apache/cordova-plugin-file/blob/master/src/android/FileUtils.java#L156 >> > > > > > ). >> > > > > > >> > > > > > If we wanted to make the change explicit to the user we could >> > change >> > > > > > plugin. >> > > > > > xml to add the preference to config.xml as well. >> > > > > > >> > > > > > Thoughts, comments, applause? >> > > > > > Simon Mac Donald >> > > > > > http://hi.im/simonmacdonald >> > > > > > >> > > > > >> > > > >> > > >> > >> > >