Welcome!

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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
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.

 

config.xml

 

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

 

Code

 

  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++) {
    alert(files[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");
  }  

Result

 

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

 

Is there something I am missing?

Retired
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)