using createDirectory?

0 views
Skip to first unread message

BenHyrman

unread,
Feb 8, 2010, 9:45:48 PM2/8/10
to phonegap
Hi all,

I've downloaded the latest from http://github.com/phonegap/phonegap
and am finding my way through. However, I'm not clear how, exactly, I
would go about creating a directory...

Stupid question first... how should I reference my directory? (As in,
the path for it). I've used documents:// as that was in an example on
the wiki.

Next, can someone hit me over the head and show me how to create a
directory?

following is my sample javascript. The testDirectoryExists works
correctly (well, it fires my success callback):

function onDeviceReady()
{
navigator.fileMgr.testDirectoryExists("documents://testDir",
check_dir_success, check_dir_died);
}

function check_dir_success(msg)
{
if(msg == 0)
{
createDir();
}
else
{
navigator.notification.alert("exists");
}
}

function check_dir_died(err)
{
navigator.notification.alert("died: " + err);
}

function createDir()
{
navigator.fileMgr.createDirectory("documents://testDir",
create_dir_sucess, create_dir_died);
}

function create_dir_success(msg)
{
navigator.notification.alert("created ");
}

function create_dir_died(err)
{
navigator.notification.alert("could not make ");
}

Many thanks!

Reply all
Reply to author
Forward
0 new messages