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

Adobe AIR Development

Reply
Developer
Posts: 249
Registered: ‎11-02-2010
My Device: PlayBook
My Carrier: -
Accepted Solution

Create directory in "shared" area

Hello all,

  I can't find a workaround for this one...

 

Is it possible to create a directory in the "shared" area of the PlayBook ?

I can write file, but I'd like to have a directory structure. And each time I invoke createDirectory I have error:

Error #3001: File or directory access denied.

 

I could create directories with my app. first release, but it was with SDK 0.9.1.

Have some restriction been updated with SDK 1.0.x ?

 

(In config file bbtablet.xml, I have following node <action>access_shared</action>, and I can write files anyway)

JC
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Create directory in "shared" area

You can create directories in the shared area. What directory are you adding it to? I would also upgrade to a 1.x SDK too.
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Create directory in "shared" area

You sure can, as long as your new folder is in one of the fixed shared folders (like Documents etc.).

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 249
Registered: ‎11-02-2010
My Device: PlayBook
My Carrier: -

Re: Create directory in "shared" area

I try to create a directory inside "documents" directory.

Directory creation must be possible indeed, so I guess I mix things up (again...) with File methods.

To access "documents", is it File.desktopDirectory ?

The doc. is not clear on a pending update... and 2 different/same mapping ?

File.desktopDirectory (appname)/shared/documents
File.documentsDirectory (appname)/shared/documents

 

JC
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Create directory in "shared" area

Use documentsDirectory.
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Create directory in "shared" area

This should create a directory if there isn't already one there, and if you have the access_shared permission:

File.documentsDirectory.resolvePath('MyApp/subdir').createDirectory();

That should show up as ...../shared/documents/MyApp/subdir.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 249
Registered: ‎11-02-2010
My Device: PlayBook
My Carrier: -

Re: Create directory in "shared" area

Damnit, that won't work...

Here is the code, there is something I don't see:

//I simply want to create "myDir" under "documents"
try { var dir:File; dir = File.documentsDirectory.resolvePath("myDir"); trace("dir="+dir.nativePath); dir.createDirectory(); } catch(error:Error) { //...
 }

 

JC
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Create directory in "shared" area

@Acenet, I think you're not really getting your blackberry-tablet.xml file into the .bar file properly.  Please check by unzipping the .bar file and inspecting it.  The file must be named air/blackberry-tablet.xml in the archive, and check that the contents really do have the <action>access_shared</action> specified.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 249
Registered: ‎11-02-2010
My Device: PlayBook
My Carrier: -

Re: Create directory in "shared" area

Ok, you're right Peter, my bbtablet.xml file was not part of the deployment.

(I mix my 2 environments with Simulator, internal sim. and real PlayBook... getting tired here ! time to submit.).

Thank you guys for your time and answers.

JC