JavaScript
{dialog.object}phoneGapEnsureDirPathURL Method
Syntax
{dialog.object}.phoneGapEnsureDirPathURL(rootpath, dirStructure, onSuccess, onError);
Arguments
- rootpath
The file URL of the existing directory that will contain the directories that are needed.
- dirStructure
The path of directories to ensure exists below the rootpath. The directories will be created if they do not exist.
- onSuccess
A javascript function that is called when the directory structure is verified to exist.
- onError
A javascript function that is called if an error occurs when trying to verify and/or create the specified directory structure.
Description
Ensures a directory structure exists within the specified root path. If the directories do not exist, they are created.
Example
var onSuccess = function() {
alert("Directory and path exists.");
};
var onError = function(e) {
alert("An error occured");
};
var rootpath = {dialog.object}.phoneGapGetLocalDirURL('public');
var dirStructure = 'toplevel/subdir1';
{dialog.object}.phoneGapEnsureDirPathURL(rootpath, dirStructure, onSuccess, onError);