Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
Trusted Contributor
Posts: 118
Registered: ‎03-06-2013
My Device: Blackberry Z10
My Carrier: Airtel
Accepted Solution

Accessing file system path

Hello There,

 

I am trying to access filesystem space, temporary / persistant, and i am able to create folders under the same and create a set of files also.

but when i am trying to access local://temporary/<folder name>/<file name> directly as a link in my html, but i am not able to do that.

 

any idea what is the problem here? how can i achieve this as accessing the same works in all platforms like Android/IOS and Windows. Why in BB10 this is not working? can u please explain?

--------
- If a post contains the solution to the problem, please click "Accept as Solution"
- If a post contains helpful content, please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Trusted Contributor
Posts: 118
Registered: ‎03-06-2013
My Device: Blackberry Z10
My Carrier: Airtel

Re: Accessing file system path

any updates on this?
--------
- If a post contains the solution to the problem, please click "Accept as Solution"
- If a post contains helpful content, please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Retired
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3
My Carrier: Bell

Re: Accessing file system path

Hi,

 

There is no path to persistent or temporary which is consistent between all Cordova platforms. The nativeURL property of the FileEntry will get you the correct path.

 

Here is an example of downloading an image, saving to persistent storage and then accessing it via an img tag:

 

https://gist.github.com/bryanhiggins/1551ba15e9049b128fd5

 

You'll need org.apache.cordova.file >= 1.1 and the following in config.xml for the example to work:

 

    <access origin="http://cordova.apache.org" />
    <access origin="file:///" />

 

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
Trusted Contributor
Posts: 118
Registered: ‎03-06-2013
My Device: Blackberry Z10
My Carrier: Airtel

Re: Accessing file system path

hi,
thanks for the reply, can u please tell me how do i include org.apache.cordova.file >= 1.1 into my application?
--------
- If a post contains the solution to the problem, please click "Accept as Solution"
- If a post contains helpful content, please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Trusted Contributor
Posts: 118
Registered: ‎03-06-2013
My Device: Blackberry Z10
My Carrier: Airtel

Re: Accessing file system path

i am using webworks BlackBerry 10 WebWorks SDK 1.0.4.11 SDK to build my application
--------
- If a post contains the solution to the problem, please click "Accept as Solution"
- If a post contains helpful content, please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Retired
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3
My Carrier: Bell

Re: Accessing file system path

Hi,

 

You'll need to upgrade to WebWorks 2.1.0.13 to use Cordova plugins.

 

In 1.0.4.11, there is no API call to get persistent/temporary storage path, but you could build it yourself like this:

 

var persistentPath = blackberry.io.home + '/webviews/webfs/persistent/local__0/',
    temporaryPath = blackberry.io.home + '/webviews/webfs/temporary/local__0/';

 

 

 

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins