You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by macdonst <gi...@git.apache.org> on 2015/07/27 23:18:07 UTC

[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

GitHub user macdonst opened a pull request:

    https://github.com/apache/cordova-plugin-file/pull/127

    Make Android default persistent file location internal

    **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:
    
    &lt;preference name="AndroidPersistentFileLocation" value="Internal" /&gt;
    
    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:
    
    &lt;preference name="AndroidPersistentFileLocation" value="Compatibility" /&gt;
    
    and the original behaviour will be retained.
    
    What I'm advocating for is to make internal storage the default behaviour for Cordova Android.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/macdonst/cordova-plugin-file master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-file/pull/127.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #127
    
----
commit ab83abc894fa28f110accd822c0202dbf38e60f2
Author: Simon MacDonald <si...@gmail.com>
Date:   2015-07-27T20:05:13Z

    Make Android default persistent file location internal

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/127#issuecomment-125350084
  
    This looks great to me!
    My only questions are, do we need a migration plugin?  or should this version include migration code?
    
    Assuming android app users are running an older version which has placed some data on their sdcard on a previous run.  Now all of their files would effectively disappear.
    
    We could mitigate this by using some sort of first run logic, which :
    
    a) checks if this plugin has been run before ( presumably by storing some hidden flag on the file system )
    b) assuming a) is false, moves files (if present) from the old location to the new.
    c) sets a flag to pass the test in a)
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/127#issuecomment-126341456
  
    @purplecabbage we make developers migrate the files if they want to go through the trouble. If they don't want to do that they can always get the old behaviour by setting the correct preference. Do we really need to write some code to show devs how to copy files from one location to another using the FileSystem API?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-file/pull/127


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/127#issuecomment-130129113
  
    Lgtm! Merge it!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/127#issuecomment-125668467
  
    When I say user, I mean someone with an app on their phone. 
    Either we migrate the users files, or we make app developers do it. The major version bump is a good first indication of the significance of the change, but we need to be sure we document it well and perhaps even provide a sample workaround for debs who need it. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/127#issuecomment-125647394
  
    @purplecabbage I don't think we need to do this as a user of an older version of this plugin only needs to set the preference "AndroidPersistentFileLocation" to "Compatibility" in config.xml and their files will re-appear. I feel adding 'first run logic' just adds code complexity when it can be handled by documentation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by macdonst <gi...@git.apache.org>.
Github user macdonst commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/127#issuecomment-126738049
  
    @jcesarmobile Good point, not sure how to handle it short of telling them not to copy and stick with compatibility for their app.
    
    Also, I've noticed that 2.0.0 and 2.1.0 always return /sdcard as the PERSISTENT filesystem no matter what you have specified in config.xml.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: Make Android default persistent ...

Posted by jcesarmobile <gi...@git.apache.org>.
Github user jcesarmobile commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/127#issuecomment-126644090
  
    I agree with @macdonst that setting the  "AndroidPersistentFileLocation" preference to "Compatibility" should be enough if the developer wants the old behaviour, but to the question "Do we really need to write some code to show devs how to copy files from one location to another using the FileSystem API?"
    
    Well, not really write code to show HOW to copy the files, there is documentation about copying files, but from WHERE? how do I get the old files location?
    
    If you change the preference to internal, "window.requestFileSystem(PERSISTENT, 0, win, fail);" will give you this location "/data/data/{android package}/files/files/", but where are the old files? How do you get them now if PERSISTENT will give you the new location?
    
    It's not obvious to me


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org