Jaxer Update Available. Jaxer 1.0 RC B is now available at the Download Page.
This release has many new features and updated APIs.

Jaxer 1.0 RC B API docs: Available inside Aptana Studio after you run the update.
Additional Info: Jaxer 0.9 Beta to Jaxer 1.0 RC Migration Guide.



Aptana Jaxer 0.9 Beta Release Documentation

Using Folder Objects

Jaxer allows access to individual folders on the file system through the Jaxer.Dir class.

Instantiating a Folder object

We can instantiate a folder object by simply newing up Jaxer.File(pathToFile). Note that creating a folder object does not automatically create the equivalent folder on the file system.

The Jaxer.Dir object expects to be created with 'resolved' paths which means they require a full path to the referenced file system object. The following code will throw an error 'NS_ERROR_FILE_UNRECOGNIZED_PATH'. To deal with this issue, use the provided Jaxer.Dir.resolve(path) method to create the required path. Jaxer version prior to 0.9.8 use Jaxer.Dir.resolvePath()

This will give us a javascript object called myFolder, which provides many useful methods for accessing the folder on the file system.

Getting information about the folder

Now that we have a folder object, we can retrieve a lot of useful information about the folder by simply using the provided accessor methods. The API docs contain a full description for the folder objects.

The most useful (or at least most commonly used) method for folder objects is exists(). This provides us with a boolean value predicated on the existence of the referenced folder on the file system.

Now that we have an instantiated folder object called 'myFolder' that we know exists, we can interrogate it to get useful information about the folder and its properties:

Managing folders on the filesystem

Some methods are available to directly manage the folders.

Creating a folder

To create a folder, invoke the create() method on a dir object.

Deleting a folder

To delete a folder, use the remove() method.

Once you delete the folder, some methods previously available on the dir object will throw exceptions if accessed.