PDG engine v0.9.5
 All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | Related Functions | List of all members
FileManager Class Reference

extras beyond what Node.js FileSystem provides More...

Public Member Functions

 findClose (object inFindData)
 stop and cleanup after a file/directory search
 
string[] findDirs (string name)
 return a list of directories that match the given name
 
string[] findFiles (string name)
 return a list of files that match the given name
 
object findFirst (string inFindName)
 get the first matching file or directory
 
object findNext (object inFindData)
 return the next matching file or directory
 
string getApplicationDataDirectory ()
 return the path to the location the application should store its user data
 
string getApplicationDirectory ()
 return the path to the location the application is installed
 
string getApplicationResourceDirectory ()
 return the path to the location where the application's internal resources are stored
 

Related Functions

(Note that these are not member functions.)

 fs
 the singleton instance of the FileManager
 
 getFileManager
 get the singleton instance of the FileManager used by the pdg framework
 

Detailed Description

extras beyond what Node.js FileSystem provides

Note
API Stability: 2 - Unstable. The API is in the process of settling, but has not yet had sufficient real-world testing to be considered stable. Backwards-compatibility will be maintained if reasonable.

Most functions for file manipulation are provided by Node.js though the FileSystem class. The PDG FileManager just adds calls to get particular directory paths and to do file searchs.

See Also
http://nodejs.org/api/fs.html

Member Function Documentation

findClose ( object  inFindData)

stop and cleanup after a file/directory search

This takes the object returned from a findFirst() or findNext(), and cleans up after the search, releasing all resources used by the search.

Parameters
inFindDatathe object returned from a prior call to findFirst() or findNext()
See Also
findFirst
findNext
findDirs ( string  name)

return a list of directories that match the given name

This uses the findFirst() and findNext() calls to search for any directories that match the name passed in. The name can contain wildcard characters (*.txt, or f1?.dat). If the name includes a path, it must use Unix format (forward slash "/" as path separators). Colon and backslash are both illegal characters.

Parameters
namethe directory name to find
Returns
an array of directories that match the name
See Also
findFirst
findNext
findFiles ( string  name)

return a list of files that match the given name

This uses the findFirst() and findNext() calls to search for any files that match the name passed in. The name can contain wildcard characters (*.txt, or f1?.dat). If the name includes a path, it must use Unix format (forward slash "/" as path separators). Colon and backslash are both illegal characters.

Parameters
namethe filename to find
Returns
an array of files that match the name
See Also
findFirst
findNext
findFirst ( string  inFindName)

get the first matching file or directory

This searches for any files or directories that match the name passed in, and returns the first one it finds. The name can contain wildcard characters (*.txt, or f1?.dat). If the name includes a path, it must use Unix format (forward slash "/" as path separators). Colon and backslash are both illegal characters.

Parameters
inFindNamethe directory or file name to find
Returns
an object with nodeName, isDirectory, and found fields: nodeName is the full path of the found item; isDirectory is true if the node is a directory, false for files; found is false if no matching item was found.
See Also
findNext
findClose
findNext ( object  inFindData)

return the next matching file or directory

This uses the object returned from a findFirst() call to continue the search and find additional matching files or directories.

Parameters
inFindDatathe object returned from a prior call to findFirst() or findNext()
Returns
an object with nodeName, isDirectory, and found fields: nodeName is the full path of the next found item; isDirectory is true if the node is a directory, false for files; found is false if no additional matching item was found.
See Also
findFirst
findClose
getApplicationDataDirectory ( )

return the path to the location the application should store its user data

Returns
a full path to the application's user data directory
getApplicationDirectory ( )

return the path to the location the application is installed

Returns
a full path to the application's directory
Note
For Mac OS X this is the location of the application bundle
getApplicationResourceDirectory ( )

return the path to the location where the application's internal resources are stored

Returns
a full path to the application's resource directory
Note
on Mac OS X the is the Contents/Resources directory within the application bundle

Friends And Related Function Documentation

getFileManager
related

get the singleton instance of the FileManager used by the pdg framework

Returns
FileManager singleton object

User Comments