You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/01/07 23:55:41 UTC

[GitHub] [cordova-plugin-file] breautek commented on issue #268: cordova.file.dataDirectory returning wrong path

breautek commented on issue #268:
URL: https://github.com/apache/cordova-plugin-file/issues/268#issuecomment-756458142


   `/data/user/0` is symlinked to `/data/data`. They are the same directory.
   
   ```
   generic_x86:/data/data/com.totalpave.iripg $ ls
   app_database app_textures app_webview cache code_cache files shared_prefs 
   
   generic_x86:/data/data/com.totalpave.iripg $ cd /data/user/0/com.totalpave.iripg
   
   generic_x86:/data/user/0/com.totalpave.iripg $ ls
   app_database app_textures app_webview cache code_cache files shared_prefs
   ```
   
   The actual file paths may differ by android versions. Generally speaking, `/data/user/0/` is used on android devices that supports multiple user accounts.
   
   While the android docs is sparse, it does say:
   
   > Caution: The exact location of where your files can be saved might vary across devices. For this reason, don't use hard-coded file paths
   
   For maximum compatibility, file paths shouldn't be hard-coded. Instead use the variables and concatenate relative paths to it.
   
   >  I also can't seem to find where the file is download.
   I'm using file.dataDirectory
   It says the directory is
   file:///data/user/0/com.app.name/files/"
   
   When I use a file manager
   I got to /storage/emulated/0/android/data/com.app.name/files and nothing is there.
   Some how a file I download is corrupt. I can't download a new one until I delete the one one. I can't find it anywhere.
   
   There is no way to have the files get download to the Download directory?
   
   This is the "external" data directory. That is, a directory that isn't private to the app. Files that are downloaded are generally placed in `/storage/emulated/0/Download` directory, although if the user was given a save dialog, they may have chosen a completely different directory. You can use the `cordova.file.externalRootDirectory` variable & concatenate the `Download` path to access this directory.
   
   Closing as not-a-bug / won't fix.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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