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

Web and WebWorks Development

Regular Visitor
Posts: 1
Registered: ‎10-29-2011
My Device: Torch
My Carrier: Rogers

blackberry.io.dir.getRootDirs() - is not a function

Trying to use the sample code and running into a problem in the tablet simulator.




<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
   version="" rim:header="My App">
   <name>My App</name>
   <content src="index.html"/>
  <feature id="blackberry.io.file" required="true" version=""/>
  <feature id="blackberry.io.dir" required="true" version=""/>
  <rimSmiley Tongueermissions>
    <rimSmiley Tongueermit>read_geolocation</rimSmiley Tongueermit>
    <rimSmiley Tongueermit>access_shared</rimSmiley Tongueermit>
  </rimSmiley Tongueermissions>
  <access uri="*" subdomains="true"/>




  var i;
  var root = blackberry.io.dir.getRootDirs();
  // Loop through all the files in the first root directory and display them
  var files = blackberry.io.dir.listFiles(root[0]);
  for (i = 0; i < files.length; i++) {
  var roots = blackberry.io.dir.getRootDirs();
  for (i = 0; i < roots.length; i++) {
    alert("Free space on '" + roots[i] + "' is " + blackberry.io.dir.getFreeSpaceForRoot(roots[i]) + " bytes");



TypeError:Result of expression 'blackberry.io.dir.getRootDirs' [undefined] is not a function.


Is there something I am missing?

Posts: 34
Registered: ‎10-24-2011
My Device: Curve
My Carrier: Telus

Re: blackberry.io.dir.getRootDirs() - is not a function

This would work if you run on phone emulator.

If you want to use something similar for Playbook call blackberry.io.dir.appDirs.


See WebWorks API Reference for more samples.

1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)