Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Regular Contributor
nfallon55
Posts: 54
Registered: 02-04-2012
My Carrier: T-Mobile

Copy databse to documets folder

Does anyone know how to copy a database file from the app assetts to the documents folder on the device?

 

Neil

Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: Copy databse to documets folder

Is that for something like a backup of the data? If not, you probably want to be copying it from the "assets" (if by that you mean the read-only installation folder where the code and such reside), to the "appdata" folder, which is the app-specific read/write folder where all data should be kept unless it's in a fairly general format which other apps could read, e.g. .doc or .jpg files.

Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: Copy databse to documets folder

Here's the actual answer, by the way (had to collect links):

 

First learn the PlayBook's filesystem layout: http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/BlackBerry-PlayBook-File-System-L...

 

Then use the flash.filesystem.File class's copy() or copyTo() methods to do the actual transfer:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
Regular Contributor
nfallon55
Posts: 54
Registered: 02-04-2012
My Carrier: T-Mobile

Re: Copy database to documents folder

Hi Peter,

 

The app that I'm working on has to have the ability of merging the data with a desktop database.  The easiest way to accomplish this is to have the database stored in the user document directory on the Playbook that can be accessed when the Playbook is plugged in via USB from the desktop app.

 

Neil

 

Please use plain text.
Developer
jtegen
Posts: 4,247
Registered: 10-27-2010
My Carrier: Verizon

Re: Copy database to documents folder

Look at the File class. It has a copy feature (copyTo).
Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: Copy database to documents folder

nfallon55, that sounds like a pretty reasonable use case to me. :smileyhappy:

Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.