Path
Description
Provides utility functions for working with file system paths.
API overview
Constructor
Path
()
Functions
Public functions
| dirExists ( path: String ): Boolean |
static Checks whether a directory exists at the given path |
| folderFromPath ( path: String ): String |
static Returns the folder the file at the path provided is in |
| getFolderDelimiter (): String |
static native Gets the system's folder delimiter "/" or "\" |
| getWritablePath (): String |
static native Returns a platform dependent path which may be written to |
| makeDir ( path: String ): Boolean |
static Recursively makes the full directory tree of the path provided |
| normalizePath ( path: String ): String |
static native Normalizes an input path to use the system folder delimiters |
| removeDir ( path: String , recursive: Boolean = false ): Boolean |
static Removes a directory (or directory tree) at the given path |
| walkFiles ( path: String , callback: Function , payload: Object = null ): Void |
static Walks a given path calling the given callback function for every file in the directory and its subdirectories |
Constructor
Path ()
Functions
dirExists ( path: String ): Boolean
static
Checks whether a directory exists at the given path.
Parameters
| path: String | The path to check. |
Returns
| Boolean | True if the path exists, false if it doesn't. |
folderFromPath ( path: String ): String
static
Returns the folder the file at the path provided is in.
Parameters
| path: String | The file path to return the folder path for. |
Returns
| String | The folder of the file path provided. |
getFolderDelimiter (): String
static native
Gets the system's folder delimiter "/" or "\". \ *
Returns
| String | The system folder delimiter string. |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
| String | fully qualified type name of the Object. |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
| Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
| String | type name of the Object. |
getWritablePath (): String
static native
Returns a platform dependent path which may be written to. For example "Documents" on OSX and Windows or the local cache on iOS/Android.
Returns
| String | An absolute path to the writable folder. |
makeDir ( path: String ): Boolean
static
Recursively makes the full directory tree of the path provided.
Parameters
| path: String | The path to create. |
Returns
| Boolean | True on success, false on failure. |
normalizePath ( path: String ): String
static native
Normalizes an input path to use the system folder delimiters.
Parameters
| path: String | The path to normalize. |
Returns
| String | The normalized path with platform directory delimiters. |
removeDir ( path: String , recursive: Boolean = false ): Boolean
static
Removes a directory (or directory tree) at the given path.
and recursive is not specified the directory will not be removed).
Parameters
| path: String | The path to remove. |
| recursive: Boolean = false | If true, delete all subfolders and files (note that if the directory is not empty |
Returns
| Boolean | True if the directory was removed, false if it wasn't. |
toString
(): String
Inherited from Object
native
Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().
Returns
| String | String that described the Object. |
walkFiles ( path: String , callback: Function , payload: Object = null ): Void
static
Walks a given path calling the given callback function for every file in the directory and its subdirectories. For 'assets' direcotry on Android this is only partally supported. There this method will list all of the non-directory files and is not recursive.
Parameters
| path: String | The path to walk. |
| callback: Function | A function with the signature function(fileName:String, payload:Object). |
| payload: Object = null | An optional object to send to the callback function. |