TorqueScript Reference
Functions

Functions

Boolean createPath (pathName)
 
Boolean directoryDelete (directoryName)
 
String fileBase (fileName)
 
Boolean fileDelete (fileName)
 
String fileExt (fileName)
 
String fileName (filePathName)
 
String filePath (fileName)
 
Integer fileSize (fileName)
 
String findFirstFile (strPattern)
 
String findFirstFileMultiExpr (strPattern)
 
String findNextFile (strPattern)
 
String findNextFileMultiExpr (string pattern)
 
String getCurrentDate (bool reverse)
 
String getCurrentDirectory ()
 
String getDirectoryList (strPath, [intDepth]?)
 
String getExecutableName ()
 
Integer getFileCount (strPattern)
 
Integer getFileCountMultiExpr (strPattern)
 
Integer getFileCRC (filename)
 
String getFileList (strPath)
 
String getMainDotCsDir ()
 
String getTemporaryDirectory ()
 
String getTemporaryFileName ()
 
String getUserDataDirectory ()
 
String getUserHomeDirectory ()
 
Boolean isDirectory (path)
 
Boolean isFile (fileName)
 
Boolean isValidImageFile (string filePath)
 
Boolean isWriteableFileName (fileName)
 
String makeFullPath (string path, [string currentWorkingDir]?)
 
String makeRelativePath (string path, string to)
 
void openFolder (path)
 
String pathConcat (string path, string file1, [... fileN] *)
 
Boolean pathCopy (fromFile, toFile, [nooverwrite=true]?)
 
void restartInstance ()
 
Boolean setCurrentDirectory (absolutePathName)
 
void setMainDotCsDir (path)
 

Detailed Description

Function Documentation

◆ createPath()

Boolean createPath ( pathName  )

Creates the path, verifing all the elements in a path exist or creating them if they do not. Note that the path should end with a slash (/). Otherwise, the last element in the path will be assumed to be a filename and not a path component, and it will not be created. For example "data/stage2/part1" will verify or create "data/stage2/" and not "part1".

◆ directoryDelete()

Boolean directoryDelete ( directoryName  )
Parameters
directoryNameName of the directory to remove
Returns
Returns true on success and false on failure

◆ fileBase()

String fileBase ( fileName  )

◆ fileDelete()

Boolean fileDelete ( fileName  )
Parameters
fileNameName of the file to remove
Returns
Returns true on success and false on failure

◆ fileExt()

String fileExt ( fileName  )
Parameters
Nameof file from which to extract extension
Returns
A string containing the file's extension (assuming all data after first '.' is the extension) or returns empty string on failure

◆ fileName()

String fileName ( filePathName  )

Extract the filename from the full path description

◆ filePath()

String filePath ( fileName  )

Extract the file path from a file's full desciption

◆ fileSize()

Integer fileSize ( fileName  )
Parameters
fileNameThe name of the file to check.
Returns
Returns the size of the file as an integer or -1 if file not found

◆ findFirstFile()

String findFirstFile ( strPattern  )
Parameters
strPatternThe string pattern to search for.
Returns
Returns a string representing the first file in the directory system matching the given pattern.

◆ findFirstFileMultiExpr()

String findFirstFileMultiExpr ( strPattern  )
Parameters
strPatternThe string pattern to search for.
Returns
Returns the first file in the directory system matching the given pattern.

◆ findNextFile()

String findNextFile ( strPattern  )
Parameters
strPatternThe string pattern to search for.
Returns
Returns the next file matching a search begun in findFirstFile.

◆ findNextFileMultiExpr()

String findNextFileMultiExpr ( string  pattern)

Returns the next file matching a search begun in findFirstFile.

◆ getCurrentDate()

String getCurrentDate ( bool  reverse)

Gets the current date and time.

Parameters
reverseDetermines if the format will be Month/Day/Year/Hour:Min:Seconds or Year/Month/Day/Hour:Min:Seconds

◆ getCurrentDirectory()

String getCurrentDirectory ( )

◆ getDirectoryList()

String getDirectoryList ( strPath  ,
[intDepth] ?   
)
Parameters
strPathThe path in which to check
intDepthThe depth in which to return (default 0 if not specified)
Returns
The directory contents

◆ getExecutableName()

String getExecutableName ( )

◆ getFileCount()

Integer getFileCount ( strPattern  )
Parameters
strPatternThe string pattern to search for.
Returns
Returns the number of files in the directory tree that match the given pattern

◆ getFileCountMultiExpr()

Integer getFileCountMultiExpr ( strPattern  )
Parameters
strPatternThe string pattern to search for.
Returns
Returns the number of files in the directory tree that match the given pattern

◆ getFileCRC()

Integer getFileCRC ( filename  )
Parameters
filenameThe string representing the file from which to get the CRC
Returns
An integer

◆ getFileList()

String getFileList ( strPath  )

Gets all the files in the specified directory.

Parameters
strPathThe path in which to check
Returns
A list of files in the specified directory.

◆ getMainDotCsDir()

String getMainDotCsDir ( )

◆ getTemporaryDirectory()

String getTemporaryDirectory ( )

Gets the path to the system's temporary directory

Returns
Returns the path to the temporary directory as a string

◆ getTemporaryFileName()

String getTemporaryFileName ( )

Generates a temporary filename for use.

Returns
Returns the formatted temporary filename for use

◆ getUserDataDirectory()

String getUserDataDirectory ( )
Returns
Returns a string to the directory storing the user's data

◆ getUserHomeDirectory()

String getUserHomeDirectory ( )
Returns
Returns the path to the user's home directory.

◆ isDirectory()

Boolean isDirectory ( path  )
Parameters
pathNamePath to check.
Returns
Returns true if the given path is a folder/directory, false otherwise

◆ isFile()

Boolean isFile ( fileName  )
Parameters
fileNameFilename to check.
Returns
Returns true if the given filename is an existing file or false otherwise

◆ isValidImageFile()

Boolean isValidImageFile ( string  filePath)
Parameters
filePathFull path of file to check.
Returns
Returns true if the given filename is a valid image file or false otherwise

◆ isWriteableFileName()

Boolean isWriteableFileName ( fileName  )
Parameters
fileNameFilename to check.
Returns
Returns true if the given filename is an existing file and is not Read-Only or false otherwise

◆ makeFullPath()

String makeFullPath ( string  path,
[string currentWorkingDir] ?   
)

◆ makeRelativePath()

String makeRelativePath ( string  path,
string  to 
)

◆ openFolder()

void openFolder ( path  )

;

◆ pathConcat()

String pathConcat ( string  path,
string  file1,
[... fileN] *   
)

◆ pathCopy()

Boolean pathCopy ( fromFile  ,
toFile  ,
[nooverwrite = true] ?   
)

◆ restartInstance()

void restartInstance ( )

◆ setCurrentDirectory()

Boolean setCurrentDirectory ( absolutePathName  )

◆ setMainDotCsDir()

void setMainDotCsDir ( path  )