FileSystem

More...

Classes:

class

Base class responsible for displaying an OS file browser.

class

This class is responsible opening, reading, creating, and saving file contents.

class

A wrapper around StreamObject for parsing text and data from files.

class

Derived from FileDialog, this class is responsible for opening a file browser with the intention of opening a file.

class

OS level dialog used for browsing folder structures.

class

Derived from FileDialog, this class is responsible for opening a file browser with the intention of saving a file.

class

File I/O object used for creating, reading, and writing XML documents.

class

Base class for working with streams.

class

Provides access to a zip file.

Functions

bool
createPath(string path)

Create the given directory or the path leading to the given filename.

string
expandFilename(string filename)

Grabs the full path of a specified file.

string
expandOldFilename(string filename)

Retrofits a filepath that uses old Torque style.

String
fileBase(string fileName)

Get the base of a file name (removes extension and path)

String
fileCreatedTime(string fileName)

Returns a platform specific formatted string with the creation time for the file.

bool
fileDelete(string path)

Delete a file from the hard drive.

String
fileExt(string fileName)

Get the extension of a file.

String
fileModifiedTime(string fileName)

Returns a platform specific formatted string with the last modified time for the file.

String
fileName(string fileName)

Get only the file name of a path and file name string (removes path)

String
filePath(string fileName)

Get the path of a file (removes name and extension)

int
fileSize(string fileName)

Determines the size of a file on disk.

String

Return the current working directory.

String
getDirectoryList(string path, int depth)

Gathers a list of directories starting at the given path.

String

Gets the name of the game's executable.

int
getFileCRC(string fileName)

Provides the CRC checksum of the given file.

String

Get the absolute path to the directory that contains the main.cs script from which the engine was started.

String

Reports the current directory.

bool
IsDirectory(string directory)

Determines if a specified directory exists or not.

bool
isFile(string fileName)

Determines if the specified file exists or not.

bool
isWriteableFileName(string fileName)

Determines if a file name can be written to using File I/O.

String
makeFullPath(string path, string cwd)

Converts a relative file path to a full path.

String
makeRelativePath(string path, string to)

Turns a full or local path to a relative one.

String
monthNumToStr(int num, bool abbreviate)

returns month as a word given a number or "" if number is bad

void
openFile(string file)

Open the given file through the system. This will usually open the file in its associated application.

void
openFolder(string path)

Open the given folder in the system's file manager.

String
pathConcat(string path, string file)

Combines two separate strings containing a file path and file name together into a single string.

bool
pathCopy(string fromFile, string toFile, bool noOverwrite)

Copy a file to a new location.

bool
setCurrentDirectory(string path)

Set the current working directory.

void

Start watching resources for file changes.

void

Stop watching resources for file changes.

String
weekdayNumToStr(int num, bool abbreviate)

returns weekday as a word given a number or "" if number is bad

Variables

string

The currently executing script file.

string

The mod folder for the currently executing script file.

Detailed Description

Functions

createPath(string path)

Create the given directory or the path leading to the given filename.

If path ends in a trailing slash, then all components in the given path will be created as directories (if not already in place). If path, does not end in a trailing slash, then the last component of the path is taken to be a file name and only the directory components of the path will be created.

Parameters:

path

The path to create.

note:

Only present in a Tools build of Torque.

expandFilename(string filename)

Grabs the full path of a specified file.

Parameters:

filename

Name of the local file to locate

return:

String containing the full filepath on disk

expandOldFilename(string filename)

Retrofits a filepath that uses old Torque style.

return:

String containing filepath with new formatting

fileBase(string fileName)

Get the base of a file name (removes extension and path)

Parameters:

fileName

Name and path of file to check

return:

String containing the file name, minus extension and path

fileCreatedTime(string fileName)

Returns a platform specific formatted string with the creation time for the file.

Parameters:

fileName

Name and path of file to check

return:

Formatted string (OS specific) containing created time, "9/3/2010 12:33:47 PM" for example

fileDelete(string path)

Delete a file from the hard drive.

Parameters:

path

Name and path of the file to delete

note:

THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.

return:

True if file was successfully deleted

fileExt(string fileName)

Get the extension of a file.

Parameters:

fileName

Name and path of file

return:

String containing the extension, such as ".exe" or ".cs"

fileModifiedTime(string fileName)

Returns a platform specific formatted string with the last modified time for the file.

Parameters:

fileName

Name and path of file to check

return:

Formatted string (OS specific) containing modified time, "9/3/2010 12:33:47 PM" for example

fileName(string fileName)

Get only the file name of a path and file name string (removes path)

Parameters:

fileName

Name and path of file to check

return:

String containing the file name, minus the path

filePath(string fileName)

Get the path of a file (removes name and extension)

Parameters:

fileName

Name and path of file to check

return:

String containing the path, minus name and extension

fileSize(string fileName)

Determines the size of a file on disk.

Parameters:

fileName

Name and path of the file to check

return:

Returns filesize in bytes, or -1 if no file

getCurrentDirectory()

Return the current working directory.

return:

The absolute path of the current working directory.

note:

Only present in a Tools build of Torque.

getDirectoryList(string path, int depth)

Gathers a list of directories starting at the given path.

Parameters:

path

String containing the path of the directory

depth

Depth of search, as in how many subdirectories to parse through

return:

Tab delimited string containing list of directories found during search, "" if no files were found

getExecutableName()

Gets the name of the game's executable.

return:

String containing this game's executable name

getFileCRC(string fileName)

Provides the CRC checksum of the given file.

Parameters:

fileName

The path to the file.

return:

The calculated CRC checksum of the file, or -1 if the file could not be found.

getMainDotCsDir()

Get the absolute path to the directory that contains the main.cs script from which the engine was started.

This directory will usually contain all the game assets and, in a user-side game installation, will usually be read-only.

return:

The path to the main game assets.

getWorkingDirectory()

Reports the current directory.

return:

String containing full file path of working directory

IsDirectory(string directory)

Determines if a specified directory exists or not.

Parameters:

directory

String containing path in the form of "foo/bar"

return:

Returns true if the directory was found.

note:

Do not include a trailing slash '/'.

isFile(string fileName)

Determines if the specified file exists or not.

Parameters:

fileName

The path to the file.

return:

Returns true if the file was found.

isWriteableFileName(string fileName)

Determines if a file name can be written to using File I/O.

Parameters:

fileName

Name and path of file to check

return:

Returns true if the file can be written to.

makeFullPath(string path, string cwd)

Converts a relative file path to a full path.

For example, "./console.log" becomes "C:/Torque/t3d/examples/FPS Example/game/console.log" Parameters:

path

Name of file or path to check

cwd

Optional current working directory from which to build the full path.

return:

String containing non-relative directory of path

makeRelativePath(string path, string to)

Turns a full or local path to a relative one.

For example, "./game/art" becomes "game/art" Parameters:

path

Full path (may include a file) to convert

to

Optional base path used for the conversion. If not supplied the current working directory is used.

return:

String containing relative path

monthNumToStr(int num, bool abbreviate)

returns month as a word given a number or "" if number is bad

return:

month as a word given a number or "" if number is bad

openFile(string file)

Open the given file through the system. This will usually open the file in its associated application.

Parameters:

file

Path of the file to open.

note:

Only present in a Tools build of Torque.

openFolder(string path)

Open the given folder in the system's file manager.

Parameters:

path

full path to a directory.

note:

Only present in a Tools build of Torque.

pathConcat(string path, string file)

Combines two separate strings containing a file path and file name together into a single string.

Parameters:

path

String containing file path

file

String containing file name

return:

String containing concatenated file name and path

pathCopy(string fromFile, string toFile, bool noOverwrite)

Copy a file to a new location.

Parameters:

fromFile

Path of the file to copy.

toFile

Path where to copy fromFile to.

noOverwrite

If true, then fromFile will not overwrite a file that may already exist at toFile.

return:

True if the file was successfully copied, false otherwise.

note:

Only present in a Tools build of Torque.

setCurrentDirectory(string path)

Set the current working directory.

Parameters:

path

The absolute or relative (to the current working directory) path of the directory which should be made the new working directory.

return:

True if the working directory was successfully changed to path, false otherwise.

note:

Only present in a Tools build of Torque.

startFileChangeNotifications()

Start watching resources for file changes.

Typically this is called during initializeCore().

stopFileChangeNotifications()

Stop watching resources for file changes.

Typically this is called during shutdownCore().

weekdayNumToStr(int num, bool abbreviate)

returns weekday as a word given a number or "" if number is bad

return:

weekday as a word given a number or "" if number is bad

Variables

string File 

The currently executing script file.

string Root 

The mod folder for the currently executing script file.