Hi Shawn- Thanks for your continued help. Can you give an example of how I'd write that out in practice. For example, none of these paths (pasted below) have led to an image that I have manually placed in /sdcard/Android/data/com.cloudkid.test_app/cache/ using adb shell. I'm using Crosswalk Canary 9.37.198.0 but I had the same results with 8.37.189.2.
<img src="file:///CACHEDIR/logo.png" /> <img src="file:///EXTERNAL_CACHEDIR/logo.png" /> I've tried many variants -- <img src="file:///CACHE_DIR/com.cloudkid.test_app/data/data/logo.png" /> etc. But I always get a FILE_NOT_FOUND error in the chrome console when remote debugging. This is with a super-simple test app, just the boilerplate code from the Getting Started example, and essentially the manifest from https://www.crosswalk-project.org/#documentation/manifest Thanks again! -Matt On Mon, Sep 1, 2014 at 5:52 AM, Gao, Shawn <[email protected]> wrote: > Hi, Matt, > > I am trying to expose the real path of CACHEDIR and EXTERNAL_CACHEDIR. > Developer can read files under these folder by “ file:// “protocol. > > > > Shawn > > > > *From:* Smith, Elliot [mailto:[email protected]] > *Sent:* Tuesday, August 19, 2014 5:10 PM > *To:* Matt Bargar > *Cc:* Gao, Shawn; [email protected] > > *Subject:* Re: [Crosswalk-help] Accessing file system > > > > Hello Matt. > > > > On 18 August 2014 13:31, Matt Bargar <[email protected]> wrote: > > Hi Shawn! Thank you so much for your continued help. I think I'm just > not expressing myself right. Imagine a scenario where we distribute an > offline web page -- html files with associated assets -- in an expansion > file, which is then placed in external_cachedir. Is there a way we can then > view that web page from within Crosswalk? > > > > Your "Not allowed to load local resource:" log messages may indicate that > you need to set the content_security_policy field in the manifest for the > application: > > > > > https://crosswalk-project.org/#documentation/manifest/content_security_policy > > > > This will allow you to load resources into the app which are outside the > sandbox. (NB I've not tried to load anything other than mp3s into an > <audio> element, so I don't know if there are other constraints which you > may run into.) > > > > Note that this field is renamed "csp" in Crosswalk 8, but still takes > values in the same format. > > > > Elliot > > > > > > Or, failing that, is there a way we can use the File API to copy the > assets to some place (/data/data/[package name]/files/ ?) we can then have > crosswalk view somehow? > > > > On Sun, Aug 17, 2014 at 9:59 PM, Gao, Shawn <[email protected]> wrote: > > Hi, > > My understanding of your requirement is you want to list out all files and > directories under EXTERNAL_CACHEDIR in a html page, something like a file > manager, right? If my understanding correctly, Yes, you can do it. But > native file system API doesn’t provide UI component. The UI component > should implement by developers. > > > > Sincerely, > > Shawn > > > > *From:* Matt Bargar [mailto:[email protected]] > *Sent:* Friday, August 15, 2014 8:39 PM > *To:* Gao, Shawn > *Cc:* Min, Hongbo; [email protected]; Huo, Halton > *Subject:* Re: [Crosswalk-help] Accessing file system > > > > Hi- > > I'm using the native file system API (xwalk.experimental) -- I do have > success reading/writing files and folders using this API. The use case I'm > trying to make work is having an html file with arbitrary content > (javascript, css, images etc) in the "EXTERNAL_CACHEDIR", and having some > way to point to all of this content, so, from my index.html file, I could > (for example) open an iframe to this html file and see its contents > "automatically". Does that make sense? Is there any way to achieve that? > Thanks! > > -Matt > > > > On Thu, Aug 14, 2014 at 9:54 PM, Gao, Shawn <[email protected]> wrote: > > Hi, Matt, > > Which file API are you tried, native file system API or w3c file API? > > Crosswalk has native file system API besides w3c file API, which can > read/write/mange file out of sandbox. Here demos the usage of this API, > https://github.com/crosswalk-project/crosswalk/blob/master/test/android/data/native_file_system.html. > > > Crosswalk restricts the ability of native file system API for security > reason. Only following path is opened for Android app developer, > > · ALARMS > > · DCIM > > · DOWNLOADS > > · MOVIES > > · MUSIC > > · NOTIFICATIONS > > · PICTURES > > · PODCASTS > > · RINGTONES > > · CACHEDIR # Cache directory of your app > > · EXTERNAL_CACHEDIR # External cache directory of your app > > Thanks, > > Shawn > > > > *From:* Min, Hongbo > *Sent:* Friday, August 15, 2014 9:27 AM > *To:* Matt Bargar; [email protected] > *Cc:* Huo, Halton; Gao, Shawn > *Subject:* RE: [Crosswalk-help] Accessing file system > > > > + Halto and Shawn > > > ------------------------------ > > *From:* Crosswalk-help [[email protected]] > on behalf of Matt Bargar [[email protected]] > *Sent:* Friday, August 15, 2014 3:22 AM > *To:* [email protected] > *Subject:* [Crosswalk-help] Accessing file system > > Hi- > > We're working on a Crosswalk app, and have a question. We are planning on > writing a Crosswalk extension that deals with expansion files. At a high > level, this theoretical extension would have two main tasks: 1. checking to > make sure any necessary OBB files were downloaded correctly, and, in our > case, unzipping the OBB file somewhere 2. providing a path to where the > files were unzipped. > > > > One of the tasks we know will need to be accomplished is reading files > (html, css, images, audio) from the file system, after the expansion file > has been unzipped. We have investigated the File API, and it's great for > what it does! We are able to successfully read in images and text and deal > with them from the javascript side (adding them to the DOM, etc.) > > > > However, our ideal use case would be to be able to point Crosswalk to the > unzipped expansion file (presumably mounted on /sdcard/ somewhere, we could > get the path from the Java side) and have it read html files natively. > i.e., we would have a /www/ folder in our expansion file, and we could > direct Crosswalk to display files inside that /www/ folder (in an iframe, > for example). What would be the best approach to this? > > > > We have tried various forms of file:/// URLs (we always get "Not allowed > to load local resource:" errors in the Chrome logs) and app:/// URLs (we > get a 403 Forbidden if we try to reach outside our app's sandbox). > > > > We are currently using Canary (9.37.192.0). Thanks for any help you can > give us! > > -Matt Bargar > > > > > > > > > _______________________________________________ > Crosswalk-help mailing list > [email protected] > https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help > > > > > > -- > Elliot Smith > Senior Software Engineer > Intel Open Source Technology Centre >
_______________________________________________ Crosswalk-help mailing list [email protected] https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help
