Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

what is application data directory ?

Hey guys,

i have created one Titanium application..

where is Applicationdatadirectory?,

How can i open it?

— asked November 12th 2010 by nilap shah
2 Comments
  • what platform?

    — commented November 12th 2010 by Aaron Saunders
  • On Android 2.2 with sdcard … if I want to look at the files on the phonewith a filebrowser, where would I look? I mount my phone but don't see anything application specific (including db which is used). Just useful for debugging … the files are created, sure enough, I just can't find them.

    — commented October 7th 2011 by Hal Burgiss

3 Answers

  • First, remember things are case sensitive so Applicationdatadirectory will not work; you need to call it applicationDataDirectory.

    The Kitchen Sink app is generally the first place to look for example code. In this case, how to open a directory and list its contents, as well as how to create a new file etc can be seen by looking at the Kitchen Sink file at /Resources/examples/filesystem.js

    — answered November 12th 2010 by Doug Handy
    permalink
    1 Comment
    • Kitchen sink example creates a directory, file within it, renames it, then deletes both. But if you comment out the delete code and recompile you discover it's all a mirage - nothing is actually created at all.

      — commented October 1st 2011 by Frann Leach
  • For iPhone:

    var file = Ti.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, 'example.txt');
    file.write('lorem ipsum');
    

    Then go into iTunes, select your device, click on 'Apps' and scroll down. Your app should be there along with files you have saved there.

    — answered November 12th 2010 by Xiao Jin
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.