Path
From Pointui
This is a Global object. You must not create an instance of it as one is always available for your use.
Provides access to functionality that can manipulate paths.
Device Specific Path Tokens
The following tokens can be included in paths and will be replaced with the local device specific path:
| Token | Description |
|---|---|
| {Application} | Path of where Home is executing from. |
| {ProgramFiles} | On English ROMs: \Program Files\ |
| {Programs} | On English ROMs: \Windows\Start Menu\Programs\ |
| {Windows} | On English ROMs: \Windows\ |
| {MyPictures} | On English ROMs: \My Pictures\ |
EXAMPLE
String path; path = “{Application}\\MyFolder”;
For the methods that support the above tokens this path would have the token “{Application}” replaced with the current application path where Home is running from.
These tokens should be used where possible to ensure compatibility across ROMs with languages other than English.
Methods
String GetAppDirectory()
Returns a String containing the full path of the directory where Home is executing from. This can be used as a starting point to build paths to sub folders of Home such as AppletRibbon, Themes etc.
String GetAppFilename()
Returns a String containing the full path and filename of the Home executable.
String Combine(String path1, String path2)
Combines two paths and returns the result. It ensures that backslashes don’t get doubled up so the returned path is valid.
String GetFilename(String fullPath)
Returns just the filename component of the path.
EXAMPLE
String fullPath, filename; //use an example path that includes a filename fullPath = “\\Program Files\\Home2\\Home.exe”; //filename will contain “Home.exe” filename = Path.GetFilename(fullPath); //GetFilename can also be used to get the folder name from a path fullPath = “\\Program Files\\Home2”; //filename will contain “Home2” filename = Path.GetFilename(fullPath);
void GetFiles(String fullPath, DataTable result)
void GetFiles(String fullPath, String searchPattern, DataTable result)
Gets the list of files and folders within the path specified and returns it in the result DataTable.
The DataTable supports the following columns:
| columnName | Expected Data Type |
|---|---|
| Filename | String |
| Extension | String |
| Size | int |
| Attributes | int |
| IsDirectory | bool |
| DateCreated | DateTime |
| DateModified | DateTime |
| DateAccessed | DateTime |
EXAMPLE
The following example gets a list of sub folders within the AppletRibbon folder:
DataTable tbl; Path.GetFiles("{Application}\\AppletRibbon", tbl); Path.RemoveFiles(tbl);
void RemoveDirectories(DataTable fromTable)
Removes all directories from the DataTable of files. The fromTable variable must have already been populated with GetFiles().
void RemoveFiles(DataTable fromTable)
Removes all files from the DataTable of files. The fromTable variable must have already been populated with GetFiles().
String ReplaceExtension(String filename, String newExtension)
Returns a String which is the result of replacing the file extension in the filename specified with the newExtension. If newExtension is not provided then the file extension is removed.
void DeleteDirectory(String path, bool recursive)
Deletes a directory. If recursive is false then the directory must not contain any sub folders otherwise it will fail. If recursive is true the entire directory will be deleted including all sub folders.
String GetExtension(String filename)
AVAILABLE SINCE: 2.1 Returns the file extension for the specified filename.
void CleanCacheFolder(String path, int cutoffAgeMinutes)
AVAILABLE SINCE: 2.1 Deletes any files in the directory specified by the path parameter that are older than cutoffAgeMinutes. It is recommended that custom cache folders created by applet developers by located under {Application}\\Cache\\[your folder].
void CreateDirectory(String path)
AVAILABLE SINCE: 2.1 Creates the specified directory.
