How do I create a directory in the BlackBerry internal memory?

advertisements

I am trying to create a directory to store my application's files in the BlackBerry's internal memory. Here's the code:

String uri = "file:///store/testapp/";
FileConnection dir;
try {
    dir = (FileConnection)Connector.open(uri, Connector.READ_WRITE);
    if (!dir.exists()){
        dir.mkdir();
    }
    dir.close();    

} catch (IOException e) {
    System.out.println(e.getMessage());
}

When I run the above I get an IOException with the message "File System Error (12)". Looking this up in the list of BlackBerry constant values this corresponds to "The operation requested is invalid.". Why can't I create the testapp directory?


You can create your own directories only in: "file:///store/home/user/"