Torque3D Documentation / _generateds / fileSystemFunctions.cpp

fileSystemFunctions.cpp

Engine/source/console/fileSystemFunctions.cpp

More...

Public Functions

buildFileList(const char * pattern, bool recurse, bool multiMatch)
DefineEngineFunction(fileBase , String , (const char *fileName) , "@brief Get the base of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name (removes extension and path)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name, minus extension and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" " @ingroup FileSystem" )
DefineEngineFunction(fileCreatedTime , String , (const char *fileName) , "@brief Returns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> platform specific formatted string with the creation time <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the file." "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Formatted string (OS specific) containing created time, \"9/3/2010 12:33:47 PM\" for <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(fileDelete , bool , (const char *path) , "@brief Delete <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> from the hard <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">drive\n\n</a>" "@param path Name and path of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">delete\n</a>" "@note THERE IS NO RECOVERY FROM THIS. Deleted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> is gone <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">good.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> was successfully <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(fileExt , String , (const char *fileName) , "@brief Get the extension of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the extension, such as \".exe\" or \"." TORQUE_SCRIPT_EXTENSION "\"\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )
DefineEngineFunction(fileModifiedTime , String , (const char *fileName) , "@brief Returns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> platform specific formatted string with the last modified time <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(fileName , String , (const char *fileName) , "@brief Get only the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name string (removes path)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name, minus the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" " @ingroup FileSystem" )
DefineEngineFunction(filePath , String , (const char *fileName) , "@brief Get the path of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> (removes name and extension)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the path, minus name and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">extension\n</a>" " @ingroup FileSystem" )
DefineEngineFunction(fileSize , S32 , (const char *fileName) , "@brief Determines the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> on <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">disk\n\n</a>" "@param fileName Name and path of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Returns filesize in bytes, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" " @ingroup FileSystem" )
DefineEngineFunction(findFirstFile , String , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> in the directory system matching the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern.\n\n</a>" "Use the corresponding findNextFile() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> step through " "the results. If you're only interested in the number of files returned by the " "pattern match, use getFileCount().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "This function differs from findFirstFileMultiExpr() in that it supports <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single search " "pattern being passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n\n</a>" " @note You cannot run multiple simultaneous <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> system searches with these functions. Each " "call <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> findFirstFile() and findFirstFileMultiExpr() initiates <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> search and renders " "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> previous search <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid.\n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">against.\n</a>" " @param recurse If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern.\n</a>" " @return The path of the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> matched by the search or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> could be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Execute all ." TORQUE_SCRIPT_EXTENSION " files in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> subdirectory and its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a>(%<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>=findFirstFile(\"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> !$= \"\"; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> = findNextFile() )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " exec( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see findNextFile()" "@see getFileCount()" "@see findFirstFileMultiExpr()" "@ingroup FileSearches" )
DefineEngineFunction(findFirstFileMultiExpr , String , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> in the directory system matching the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns.\n\n</a>" "Use the corresponding findNextFileMultiExpr() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> step through " "the results. If you're only interested in the number of files returned by the " "pattern match, use getFileCountMultiExpr().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "This function differs from findFirstFile() in that it supports multiple search patterns " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n\n</a>" " @note You cannot run multiple simultaneous <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> system searches with these functions. Each " "call <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> findFirstFile() and findFirstFileMultiExpr() initiates <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> search and renders " "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> previous search <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid.\n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against, such as *." TORQUE_SCRIPT_EXTENSION ". Separate " "multiple patterns with TABs. For example:\"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n" "@param recurse If true, the search will exhaustively recurse into subdirectories " "of the given path and match the given filename <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns.\n</a>" " @return <a href="/coding/class/classstring/">String</a> of the first matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path, or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching " "files were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Find all DTS or Collada <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">models\n</a>" "% filePatterns)
DefineEngineFunction(findNextFile , String , (const char *pattern) , ("") , "@brief Returns the next <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> matching <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> search begun in findFirstFile().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against. This is optional " "and may be left out as it is not used by the code. It is here <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> legacy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reasons.\n</a>" "@return The path of the next filename matched by the search or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no more files <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">match.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Execute all ." TORQUE_SCRIPT_EXTENSION " files in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> subdirectory and its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a>( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> = findFirstFile( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> !$= \"\"; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> = findNextFile() )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " exec( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see findFirstFile()" "@ingroup FileSearches" )
DefineEngineFunction(findNextFileMultiExpr , String , (const char *pattern) , ("") , "@brief Returns the next <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> matching <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> search begun in findFirstFileMultiExpr().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against. This is optional " "and may be left out as it is not used by the code. It is here <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> legacy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reasons.\n</a>" "@return <a href="/coding/class/classstring/">String</a> of the next matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path, or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching " "files were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Find all DTS or Collada <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">models\n</a>" "% filePatterns)
DefineEngineFunction(getDirectoryList , String , (const char *path, S32 depth) , ("", 0) , "@brief Gathers <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of directories starting at the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n\n</a>" "@param path <a href="/coding/class/classstring/">String</a> containing the path of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">directory\n</a>" "@param depth Depth of search, as in how many subdirectories <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> parse <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">through\n</a>" " @return Tab delimited string containing list of directories found during search, \"\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no files were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(getExecutableName , String , () , "@brief Gets the name of the game's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">executable\n\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing this game's executable <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(getFileCount , S32 , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the number of files in the directory tree that match the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns\n\n</a>" "This function differs from getFileCountMultiExpr() in that it supports <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single search " "pattern being passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n\n</a>" "If you're interested in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of files that match the given pattern and not just " "the number of files, use findFirstFile() and findNextFile().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">against.\n</a>" " @param recurse If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename pattern " "counting files in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" " @return Number of files located using the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Count the number of ." TORQUE_SCRIPT_EXTENSION " files in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> subdirectory and its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" "getFileCount(\"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see findFirstFile()" "@see findNextFile()" "@see getFileCountMultiExpr()" "@ingroup FileSearches" )
DefineEngineFunction(getFileCountMultiExpr , S32 , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the number of files in the directory tree that match the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns\n\n</a>" "If you're interested in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of files that match the given patterns and not just " "the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against, such as *." TORQUE_SCRIPT_EXTENSION ". Separate " "multiple patterns with TABs. For example:\"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n" "@param recurse If true, the search will exhaustively recurse into subdirectories " "of the given path and match the given filename <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern.\n</a>" " @return Number of files located using the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Count all DTS or Collada <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">models\n</a>" "% filePatterns)
DefineEngineFunction(getFileCRC , S32 , (const char *fileName) , "@brief Provides the CRC checksum of the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n\n</a>" "@param fileName The path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" "@return The calculated CRC checksum of the file, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> " "could not be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" " @ingroup FileSystem" )
DefineEngineFunction(getMainDotCsDir , String , () , "@brief Get the absolute path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the directory that contains the main." TORQUE_SCRIPT_EXTENSION " script from which the engine was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">started.\n\n</a>" "This directory will usually contain all the game assets and, in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> user-side game installation, will usually be " "read-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">only.\n\n</a>" " @return The path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/x86unixmain_8cpp/#x86unixmain_8cpp_1a217dbf8b442f20279ea00b898af96f52">main</a> game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">assets.\n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">FileSystem\n</a>" )
DefineEngineFunction(getWorkingDirectory , String , () , "@brief Reports the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">directory\n\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path of working <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">directory\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(IsDirectory , bool , (const char *directory) , "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified directory exists or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n\n</a>" "@param directory <a href="/coding/class/classstring/">String</a> containing path in the form of \"foo/bar\"\n" "@return Returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the directory was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@note Do not include <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> trailing slash '/'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )
DefineEngineFunction(isFile , bool , (const char *fileName) , "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> exists or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n\n</a>" "@param fileName The path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" "@return Returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(isWriteableFileName , bool , (const char *fileName) , "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name can be written <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> using <a href="/coding/class/classfile/">File</a> I/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">O\n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> can be written <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(makeFullPath , String , (const char *path, const char *cwd) , ("", "") , "@brief Converts <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n\n</a>" "For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n" "@param path Name of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> or path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@param cwd Optional current working directory from which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> build the full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing non-relative directory of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(makeRelativePath , String , (const char *path, const char *to) , ("", "") , "@brief Turns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> full or local path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">one\n\n</a>" "For example, \"./game/art\" becomes \"game/art\"\n" "@param path Full path (may include <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>) <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">convert\n</a>" "@param <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> Optional base path used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the conversion. If not supplied the current " "working directory is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">used.\n</a>" "@returns <a href="/coding/class/classstring/">String</a> containing relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(pathConcat , String , (const char *path, const char *file) , ("", "") , "@brief Combines two separate strings containing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name together into <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">string\n\n</a>" "@param path <a href="/coding/class/classstring/">String</a> containing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/class/classstring/">String</a> containing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing concatenated <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@ingroup FileSystem" )
DefineEngineFunction(startFileChangeNotifications , void , () , "@brief Start watching resources <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">changes\n\n</a>" "Typically this is called during initializeCore().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@see stopFileChangeNotifications()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )
DefineEngineFunction(stopFileChangeNotifications , void , () , "@brief Stop watching resources <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">changes\n\n</a>" "Typically this is called during shutdownCore().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@see startFileChangeNotifications()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )
forwardslash(char * str)

Detailed Description

Public Variables

U32 sgFindFilesPos 
Vector< String > sgFindFilesResults 
char sgScriptFilenameBuffer [1024]

Public Functions

buildFileList(const char * pattern, bool recurse, bool multiMatch)

DefineEngineFunction(fileBase , String , (const char *fileName) , "@brief Get the base of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name (removes extension and path)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name, minus extension and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" " @ingroup FileSystem" )

DefineEngineFunction(fileCreatedTime , String , (const char *fileName) , "@brief Returns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> platform specific formatted string with the creation time <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the file." "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Formatted string (OS specific) containing created time, \"9/3/2010 12:33:47 PM\" for <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(fileDelete , bool , (const char *path) , "@brief Delete <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> from the hard <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">drive\n\n</a>" "@param path Name and path of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">delete\n</a>" "@note THERE IS NO RECOVERY FROM THIS. Deleted <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> is gone <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">good.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> was successfully <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(fileExt , String , (const char *fileName) , "@brief Get the extension of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the extension, such as \".exe\" or \"." TORQUE_SCRIPT_EXTENSION "\"\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )

DefineEngineFunction(fileModifiedTime , String , (const char *fileName) , "@brief Returns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> platform specific formatted string with the last modified time <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(fileName , String , (const char *fileName) , "@brief Get only the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name string (removes path)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name, minus the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" " @ingroup FileSystem" )

DefineEngineFunction(filePath , String , (const char *fileName) , "@brief Get the path of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> (removes name and extension)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing the path, minus name and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">extension\n</a>" " @ingroup FileSystem" )

DefineEngineFunction(fileSize , S32 , (const char *fileName) , "@brief Determines the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> on <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">disk\n\n</a>" "@param fileName Name and path of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Returns filesize in bytes, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" " @ingroup FileSystem" )

DefineEngineFunction(findFirstFile , String , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> in the directory system matching the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern.\n\n</a>" "Use the corresponding findNextFile() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> step through " "the results. If you're only interested in the number of files returned by the " "pattern match, use getFileCount().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "This function differs from findFirstFileMultiExpr() in that it supports <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single search " "pattern being passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n\n</a>" " @note You cannot run multiple simultaneous <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> system searches with these functions. Each " "call <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> findFirstFile() and findFirstFileMultiExpr() initiates <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> search and renders " "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> previous search <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid.\n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">against.\n</a>" " @param recurse If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern.\n</a>" " @return The path of the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> matched by the search or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> could be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Execute all ." TORQUE_SCRIPT_EXTENSION " files in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> subdirectory and its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a>(%<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>=findFirstFile(\"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> !$= \"\"; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> = findNextFile() )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " exec( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see findNextFile()" "@see getFileCount()" "@see findFirstFileMultiExpr()" "@ingroup FileSearches" )

DefineEngineFunction(findFirstFileMultiExpr , String , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> in the directory system matching the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns.\n\n</a>" "Use the corresponding findNextFileMultiExpr() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> step through " "the results. If you're only interested in the number of files returned by the " "pattern match, use getFileCountMultiExpr().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "This function differs from findFirstFile() in that it supports multiple search patterns " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n\n</a>" " @note You cannot run multiple simultaneous <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> system searches with these functions. Each " "call <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> findFirstFile() and findFirstFileMultiExpr() initiates <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> search and renders " "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> previous search <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">invalid.\n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against, such as *." TORQUE_SCRIPT_EXTENSION ". Separate " "multiple patterns with TABs. For example:\"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n" "@param recurse If true, the search will exhaustively recurse into subdirectories " "of the given path and match the given filename <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns.\n</a>" " @return <a href="/coding/class/classstring/">String</a> of the first matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path, or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching " "files were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Find all DTS or Collada <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">models\n</a>" "% filePatterns)

DefineEngineFunction(findNextFile , String , (const char *pattern) , ("") , "@brief Returns the next <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> matching <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> search begun in findFirstFile().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against. This is optional " "and may be left out as it is not used by the code. It is here <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> legacy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reasons.\n</a>" "@return The path of the next filename matched by the search or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no more files <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">match.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Execute all ." TORQUE_SCRIPT_EXTENSION " files in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> subdirectory and its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a>( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> = findFirstFile( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> !$= \"\"; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> = findNextFile() )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " exec( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see findFirstFile()" "@ingroup FileSearches" )

DefineEngineFunction(findNextFileMultiExpr , String , (const char *pattern) , ("") , "@brief Returns the next <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> matching <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> search begun in findFirstFileMultiExpr().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against. This is optional " "and may be left out as it is not used by the code. It is here <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> legacy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reasons.\n</a>" "@return <a href="/coding/class/classstring/">String</a> of the next matching <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path, or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching " "files were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Find all DTS or Collada <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">models\n</a>" "% filePatterns)

DefineEngineFunction(getDirectoryList , String , (const char *path, S32 depth) , ("", 0) , "@brief Gathers <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of directories starting at the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n\n</a>" "@param path <a href="/coding/class/classstring/">String</a> containing the path of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">directory\n</a>" "@param depth Depth of search, as in how many subdirectories <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> parse <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">through\n</a>" " @return Tab delimited string containing list of directories found during search, \"\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no files were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(getExecutableName , String , () , "@brief Gets the name of the game's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">executable\n\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing this game's executable <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(getFileCount , S32 , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the number of files in the directory tree that match the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns\n\n</a>" "This function differs from getFileCountMultiExpr() in that it supports <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single search " "pattern being passed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n\n</a>" "If you're interested in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of files that match the given pattern and not just " "the number of files, use findFirstFile() and findNextFile().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">against.\n</a>" " @param recurse If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename pattern " "counting files in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" " @return Number of files located using the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Count the number of ." TORQUE_SCRIPT_EXTENSION " files in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> subdirectory and its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subdirectories.\n</a>" "getFileCount(\"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@see findFirstFile()" "@see findNextFile()" "@see getFileCountMultiExpr()" "@ingroup FileSearches" )

DefineEngineFunction(getFileCountMultiExpr , S32 , (const char *pattern, bool recurse) , ("", true) , "@brief Returns the number of files in the directory tree that match the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns\n\n</a>" "If you're interested in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> list of files that match the given patterns and not just " "the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @param pattern The path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name pattern <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> match against, such as *." TORQUE_SCRIPT_EXTENSION ". Separate " "multiple patterns with TABs. For example:\"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n" "@param recurse If true, the search will exhaustively recurse into subdirectories " "of the given path and match the given filename <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pattern.\n</a>" " @return Number of files located using the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">patterns\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Count all DTS or Collada <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">models\n</a>" "% filePatterns)

DefineEngineFunction(getFileCRC , S32 , (const char *fileName) , "@brief Provides the CRC checksum of the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n\n</a>" "@param fileName The path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" "@return The calculated CRC checksum of the file, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> " "could not be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" " @ingroup FileSystem" )

DefineEngineFunction(getMainDotCsDir , String , () , "@brief Get the absolute path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the directory that contains the main." TORQUE_SCRIPT_EXTENSION " script from which the engine was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">started.\n\n</a>" "This directory will usually contain all the game assets and, in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> user-side game installation, will usually be " "read-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">only.\n\n</a>" " @return The path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/x86unixmain_8cpp/#x86unixmain_8cpp_1a217dbf8b442f20279ea00b898af96f52">main</a> game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">assets.\n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">FileSystem\n</a>" )

DefineEngineFunction(getWorkingDirectory , String , () , "@brief Reports the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">directory\n\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path of working <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">directory\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(IsDirectory , bool , (const char *directory) , "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified directory exists or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n\n</a>" "@param directory <a href="/coding/class/classstring/">String</a> containing path in the form of \"foo/bar\"\n" "@return Returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the directory was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@note Do not include <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> trailing slash '/'.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )

DefineEngineFunction(isFile , bool , (const char *fileName) , "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> exists or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n\n</a>" "@param fileName The path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" "@return Returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(isWriteableFileName , bool , (const char *fileName) , "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name can be written <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> using <a href="/coding/class/classfile/">File</a> I/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">O\n\n</a>" "@param fileName Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@return Returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> can be written <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(makeFullPath , String , (const char *path, const char *cwd) , ("", "") , "@brief Converts <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n\n</a>" "For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n" "@param path Name of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> or path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">check\n</a>" "@param cwd Optional current working directory from which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> build the full <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing non-relative directory of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(makeRelativePath , String , (const char *path, const char *to) , ("", "") , "@brief Turns <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> full or local path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">one\n\n</a>" "For example, \"./game/art\" becomes \"game/art\"\n" "@param path Full path (may include <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a>) <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">convert\n</a>" "@param <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> Optional base path used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the conversion. If not supplied the current " "working directory is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">used.\n</a>" "@returns <a href="/coding/class/classstring/">String</a> containing relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(pathConcat , String , (const char *path, const char *file) , ("", "") , "@brief Combines two separate strings containing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> path and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name together into <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">string\n\n</a>" "@param path <a href="/coding/class/classstring/">String</a> containing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/class/classstring/">String</a> containing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" "@return <a href="/coding/class/classstring/">String</a> containing concatenated <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> name and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path\n</a>" "@ingroup FileSystem" )

DefineEngineFunction(startFileChangeNotifications , void , () , "@brief Start watching resources <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">changes\n\n</a>" "Typically this is called during initializeCore().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@see stopFileChangeNotifications()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )

DefineEngineFunction(stopFileChangeNotifications , void , () , "@brief Stop watching resources <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">changes\n\n</a>" "Typically this is called during shutdownCore().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@see startFileChangeNotifications()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@ingroup FileSystem" )

forwardslash(char * str)

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#include "platform/platform.h"
 25#include "console/console.h"
 26#include "console/consoleInternal.h"
 27#include "console/engineAPI.h"
 28#include "console/ast.h"
 29#include "core/stream/fileStream.h"
 30#include "console/compiler.h"
 31#include "platform/platformInput.h"
 32#include "torqueConfig.h"
 33#include "core/frameAllocator.h"
 34
 35// Buffer for expanding script filenames.
 36static char sgScriptFilenameBuffer[1024];
 37
 38//-------------------------------------- Helper Functions
 39static void forwardslash(char *str)
 40{
 41   while(*str)
 42   {
 43      if(*str == '\\')
 44         *str = '/';
 45      str++;
 46   }
 47}
 48
 49//----------------------------------------------------------------
 50
 51static Vector<String>   sgFindFilesResults;
 52static U32              sgFindFilesPos = 0;
 53
 54static S32 buildFileList(const char* pattern, bool recurse, bool multiMatch)
 55{
 56   static const String sSlash( "/" );
 57
 58   sgFindFilesResults.clear();
 59
 60   String sPattern(Torque::Path::CleanSeparators(pattern));
 61   if(sPattern.isEmpty())
 62   {
 63      Con::errorf("findFirstFile() requires a search pattern");
 64      return -1;
 65   }
 66
 67   if(!Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), sPattern.c_str()))
 68   {
 69      Con::errorf("findFirstFile() given initial directory cannot be expanded: '%s'", pattern);
 70      return -1;
 71   }
 72   sPattern = String::ToString(sgScriptFilenameBuffer);
 73
 74   String::SizeType slashPos = sPattern.find('/', 0, String::Right);
 75//    if(slashPos == String::NPos)
 76//    {
 77//       Con::errorf("findFirstFile() missing search directory or expression: '%s'", sPattern.c_str());
 78//       return -1;
 79//    }
 80
 81   // Build the initial search path
 82   Torque::Path givenPath(Torque::Path::CompressPath(sPattern));
 83   givenPath.setFileName("*");
 84   givenPath.setExtension("*");
 85
 86   if(givenPath.getPath().length() > 0 && givenPath.getPath().find('*', 0, String::Right) == givenPath.getPath().length()-1)
 87   {
 88      // Deal with legacy searches of the form '*/*.*'
 89      String suspectPath = givenPath.getPath();
 90      String::SizeType newLen = suspectPath.length()-1;
 91      if(newLen > 0 && suspectPath.find('/', 0, String::Right) == suspectPath.length()-2)
 92      {
 93         --newLen;
 94      }
 95      givenPath.setPath(suspectPath.substr(0, newLen));
 96   }
 97
 98   Torque::FS::FileSystemRef fs = Torque::FS::GetFileSystem(givenPath);
 99   //Torque::Path path = fs->mapTo(givenPath);
100   Torque::Path path = givenPath;
101   
102   // Make sure that we have a root so the correct file system can be determined when using zips
103   if(givenPath.isRelative())
104      path = Torque::Path::Join(Torque::FS::GetCwd(), '/', givenPath);
105   
106   path.setFileName(String::EmptyString);
107   path.setExtension(String::EmptyString);
108   if(!Torque::FS::IsDirectory(path))
109   {
110      Con::errorf("findFirstFile() invalid initial search directory: '%s'", path.getFullPath().c_str());
111      return -1;
112   }
113
114   // Build the search expression
115   const String expression(slashPos != String::NPos ? sPattern.substr(slashPos+1) : sPattern);
116   if(expression.isEmpty())
117   {
118      Con::errorf("findFirstFile() requires a search expression: '%s'", sPattern.c_str());
119      return -1;
120   }
121
122   S32 results = Torque::FS::FindByPattern(path, expression, recurse, sgFindFilesResults, multiMatch );
123   if(givenPath.isRelative() && results > 0)
124   {
125      // Strip the CWD out of the returned paths
126      // MakeRelativePath() returns incorrect results (it adds a leading ..) so doing this the dirty way
127      const String cwd = Torque::FS::GetCwd().getFullPath();
128      for(S32 i = 0;i < sgFindFilesResults.size();++i)
129      {
130         String str = sgFindFilesResults[i];
131         if(str.compare(cwd, cwd.length(), String::NoCase) == 0)
132            str = str.substr(cwd.length());
133         sgFindFilesResults[i] = str;
134      }
135   }
136   return results;
137}
138
139//-----------------------------------------------------------------------------
140
141DefineEngineFunction( findFirstFile, String, ( const char* pattern, bool recurse ), ( "", true ),
142   "@brief Returns the first file in the directory system matching the given pattern.\n\n"
143
144   "Use the corresponding findNextFile() to step through "
145   "the results.  If you're only interested in the number of files returned by the "
146   "pattern match, use getFileCount().\n\n"
147
148   "This function differs from findFirstFileMultiExpr() in that it supports a single search "
149   "pattern being passed in.\n\n"
150
151   "@note You cannot run multiple simultaneous file system searches with these functions.  Each "
152   "call to findFirstFile() and findFirstFileMultiExpr() initiates a new search and renders "
153   "a previous search invalid.\n\n"
154
155   "@param pattern The path and file name pattern to match against.\n"
156   "@param recurse If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename pattern.\n"
157   "@return The path of the first file matched by the search or an empty string if no matching file could be found.\n\n"
158
159   "@tsexample\n"
160      "// Execute all ." TORQUE_SCRIPT_EXTENSION " files in a subdirectory and its subdirectories.\n"
161      "for( %file = findFirstFile( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %file !$= \"\"; %file = findNextFile() )\n"
162      "   exec( %file );\n"
163   "@endtsexample\n\n"
164
165   "@see findNextFile()"
166   "@see getFileCount()"
167   "@see findFirstFileMultiExpr()"
168   "@ingroup FileSearches" )
169{
170   S32 numResults = buildFileList( pattern, recurse, false);
171
172   // For Debugging
173   //for ( S32 i = 0; i < sgFindFilesResults.size(); i++ )
174   //   Con::printf( " [%i] [%s]", i, sgFindFilesResults[i].c_str() );
175
176   sgFindFilesPos = 1;
177
178   if(numResults < 0)
179   {
180      Con::errorf("findFirstFile() search directory not found: '%s'", pattern);
181      return String();
182   }
183
184   return numResults ? sgFindFilesResults[0] : String();
185}
186
187//-----------------------------------------------------------------------------
188
189DefineEngineFunction( findNextFile, String, ( const char* pattern ), ( "" ),
190   "@brief Returns the next file matching a search begun in findFirstFile().\n\n"
191
192   "@param pattern The path and file name pattern to match against.  This is optional "
193   "and may be left out as it is not used by the code.  It is here for legacy reasons.\n"
194   "@return The path of the next filename matched by the search or an empty string if no more files match.\n\n"
195
196   "@tsexample\n"
197      "// Execute all ." TORQUE_SCRIPT_EXTENSION " files in a subdirectory and its subdirectories.\n"
198      "for( %file = findFirstFile( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %file !$= \"\"; %file = findNextFile() )\n"
199      "   exec( %file );\n"
200   "@endtsexample\n\n"
201
202   "@see findFirstFile()"
203   "@ingroup FileSearches" )
204{
205   if ( sgFindFilesPos + 1 > sgFindFilesResults.size() )
206      return String();
207
208   return sgFindFilesResults[sgFindFilesPos++];
209}
210
211//-----------------------------------------------------------------------------
212
213DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ), ( "", true ),
214   "@brief Returns the number of files in the directory tree that match the given patterns\n\n"
215
216   "This function differs from getFileCountMultiExpr() in that it supports a single search "
217   "pattern being passed in.\n\n"
218
219   "If you're interested in a list of files that match the given pattern and not just "
220   "the number of files, use findFirstFile() and findNextFile().\n\n"
221
222   "@param pattern The path and file name pattern to match against.\n"
223   "@param recurse If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename pattern "
224      "counting files in subdirectories.\n"
225   "@return Number of files located using the pattern\n\n"
226
227   "@tsexample\n"
228      "// Count the number of ." TORQUE_SCRIPT_EXTENSION " files in a subdirectory and its subdirectories.\n"
229      "getFileCount( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" );\n"
230   "@endtsexample\n\n"
231
232   "@see findFirstFile()"
233   "@see findNextFile()"
234   "@see getFileCountMultiExpr()"
235   "@ingroup FileSearches" )
236{
237   S32 numResults = buildFileList( pattern, recurse, false );
238
239   if(numResults < 0)
240   {
241      return 0;
242   }
243
244   return numResults;
245}
246
247//-----------------------------------------------------------------------------
248
249DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool recurse ), ( "", true),
250   "@brief Returns the first file in the directory system matching the given patterns.\n\n"
251
252   "Use the corresponding findNextFileMultiExpr() to step through "
253   "the results.  If you're only interested in the number of files returned by the "
254   "pattern match, use getFileCountMultiExpr().\n\n"
255
256   "This function differs from findFirstFile() in that it supports multiple search patterns "
257   "to be passed in.\n\n"
258
259   "@note You cannot run multiple simultaneous file system searches with these functions.  Each "
260   "call to findFirstFile() and findFirstFileMultiExpr() initiates a new search and renders "
261   "a previous search invalid.\n\n"
262
263   "@param pattern The path and file name pattern to match against, such as *." TORQUE_SCRIPT_EXTENSION ".  Separate "
264   "multiple patterns with TABs.  For example: \"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n"
265   "@param recurse If true, the search will exhaustively recurse into subdirectories "
266   "of the given path and match the given filename patterns.\n"
267   "@return String of the first matching file path, or an empty string if no matching "
268   "files were found.\n\n"
269
270   "@tsexample\n"
271      "// Find all DTS or Collada models\n"
272      "%filePatterns = \"*.dts\" TAB \"*.dae\";\n"
273      "%fullPath = findFirstFileMultiExpr( %filePatterns );\n"
274      "while ( %fullPath !$= \"\" )\n"
275      "{\n"
276      "   echo( %fullPath );\n"
277      "   %fullPath = findNextFileMultiExpr( %filePatterns );\n"
278      "}\n"
279   "@endtsexample\n\n"
280
281   "@see findNextFileMultiExpr()"
282   "@see getFileCountMultiExpr()"
283   "@see findFirstFile()"
284   "@ingroup FileSearches")
285{
286   S32 numResults = buildFileList(pattern, recurse, true);
287
288   // For Debugging
289   //for ( S32 i = 0; i < sgFindFilesResults.size(); i++ )
290   //   Con::printf( " [%i] [%s]", i, sgFindFilesResults[i].c_str() );
291
292   sgFindFilesPos = 1;
293
294   if(numResults < 0)
295   {
296      Con::errorf("findFirstFileMultiExpr() search directory not found: '%s'", pattern);
297      return String();
298   }
299
300   return numResults ? sgFindFilesResults[0] : String();
301}
302
303DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""),
304   "@brief Returns the next file matching a search begun in findFirstFileMultiExpr().\n\n"
305
306   "@param pattern The path and file name pattern to match against.  This is optional "
307   "and may be left out as it is not used by the code.  It is here for legacy reasons.\n"
308   "@return String of the next matching file path, or an empty string if no matching "
309   "files were found.\n\n"
310
311   "@tsexample\n"
312      "// Find all DTS or Collada models\n"
313      "%filePatterns = \"*.dts\" TAB \"*.dae\";\n"
314      "%fullPath = findFirstFileMultiExpr( %filePatterns );\n"
315      "while ( %fullPath !$= \"\" )\n"
316      "{\n"
317      "   echo( %fullPath );\n"
318      "   %fullPath = findNextFileMultiExpr( %filePatterns );\n"
319      "}\n"
320   "@endtsexample\n\n"
321
322   "@see findFirstFileMultiExpr()"
323   "@ingroup FileSearches")
324{
325   if ( sgFindFilesPos + 1 > sgFindFilesResults.size() )
326      return String();
327
328   return sgFindFilesResults[sgFindFilesPos++];
329}
330
331DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool recurse ), ( "", true),
332   "@brief Returns the number of files in the directory tree that match the given patterns\n\n"
333
334   "If you're interested in a list of files that match the given patterns and not just "
335   "the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().\n\n"
336
337   "@param pattern The path and file name pattern to match against, such as *." TORQUE_SCRIPT_EXTENSION ".  Separate "
338   "multiple patterns with TABs.  For example: \"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n"
339   "@param recurse If true, the search will exhaustively recurse into subdirectories "
340   "of the given path and match the given filename pattern.\n"
341   "@return Number of files located using the patterns\n\n"
342
343   "@tsexample\n"
344      "// Count all DTS or Collada models\n"
345      "%filePatterns = \"*.dts\" TAB \"*.dae\";\n"
346      "echo( \"Nunmer of shape files:\" SPC getFileCountMultiExpr( %filePatterns ) );\n"
347   "@endtsexample\n\n"
348
349   "@see findFirstFileMultiExpr()"
350   "@see findNextFileMultiExpr()"
351   "@ingroup FileSearches")
352{
353   S32 numResults = buildFileList(pattern, recurse, true);
354
355   if(numResults < 0)
356   {
357      return 0;
358   }
359
360   return numResults;
361}
362
363DefineEngineFunction(getFileCRC, S32, ( const char* fileName ),,
364   "@brief Provides the CRC checksum of the given file.\n\n"
365   
366   "@param fileName The path to the file.\n"
367   "@return The calculated CRC checksum of the file, or -1 if the file "
368   "could not be found.\n"
369   
370   "@ingroup FileSystem")
371{
372   String cleanfilename(Torque::Path::CleanSeparators(fileName));
373   Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), cleanfilename.c_str());
374
375   Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
376   Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode( givenPath );
377
378   if ( fileRef == NULL )
379   {
380      Con::errorf("getFileCRC() - could not access file: [%s]", givenPath.getFullPath().c_str() );
381      return -1;
382   }
383
384   return fileRef->getChecksum();
385}
386
387DefineEngineFunction(isFile, bool, ( const char* fileName ),,
388   "@brief Determines if the specified file exists or not\n\n"
389   
390   "@param fileName The path to the file.\n"
391   "@return Returns true if the file was found.\n"
392   
393   "@ingroup FileSystem")
394{
395   String cleanfilename(Torque::Path::CleanSeparators(fileName));
396   Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), cleanfilename.c_str());
397
398   Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
399   return Torque::FS::IsFile(givenPath);
400}
401
402DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
403   "@brief Determines if a specified directory exists or not\n\n"
404
405   "@param directory String containing path in the form of \"foo/bar\"\n"
406   "@return Returns true if the directory was found.\n"
407
408   "@note Do not include a trailing slash '/'.\n"
409
410   "@ingroup FileSystem")
411{
412   String dir(Torque::Path::CleanSeparators(directory));
413   Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), dir.c_str());
414
415   Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
416   return Torque::FS::IsDirectory( givenPath );
417}
418
419DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),,
420   "@brief Determines if a file name can be written to using File I/O\n\n"
421
422   "@param fileName Name and path of file to check\n"
423   "@return Returns true if the file can be written to.\n"
424
425   "@ingroup FileSystem")
426{
427   String filename(Torque::Path::CleanSeparators(fileName));
428   Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), filename.c_str());
429
430   Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
431   Torque::FS::FileSystemRef fs = Torque::FS::GetFileSystem(givenPath);
432   Torque::Path path = fs->mapTo(givenPath);
433
434   return !Torque::FS::IsReadOnly(path);
435}
436
437DefineEngineFunction(startFileChangeNotifications, void, (),,
438   "@brief Start watching resources for file changes\n\n"
439   "Typically this is called during initializeCore().\n\n"
440   "@see stopFileChangeNotifications()\n"
441   "@ingroup FileSystem")
442{
443   Torque::FS::StartFileChangeNotifications();
444}
445
446DefineEngineFunction(stopFileChangeNotifications, void, (),,
447   "@brief Stop watching resources for file changes\n\n"
448   "Typically this is called during shutdownCore().\n\n"
449   "@see startFileChangeNotifications()\n"
450   "@ingroup FileSystem")
451{
452   Torque::FS::StopFileChangeNotifications();
453}
454
455
456DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ), ( "", 0 ),
457   "@brief Gathers a list of directories starting at the given path.\n\n"
458
459   "@param path String containing the path of the directory\n"
460   "@param depth Depth of search, as in how many subdirectories to parse through\n"
461   "@return Tab delimited string containing list of directories found during search, \"\" if no files were found\n"
462
463   "@ingroup FileSystem")
464{
465   // Grab the full path.
466   char fullpath[1024];
467   Platform::makeFullPathName(String::compare(path, "/") == 0 ? "" : path, fullpath, sizeof(fullpath));
468
469   //dSprintf(fullpath, 511, "%s/%s", Platform::getWorkingDirectory(), path);
470
471   // Append a trailing backslash if it's not present already.
472   if (fullpath[dStrlen(fullpath) - 1] != '/')
473   {
474      S32 pos = dStrlen(fullpath);
475      fullpath[pos] = '/';
476      fullpath[pos + 1] = '\0';
477   }
478
479   // Dump the directories.
480   Vector<StringTableEntry> directories;
481   Platform::dumpDirectories(fullpath, directories, depth, true);
482
483   if( directories.empty() )
484      return "";
485
486   // Grab the required buffer length.
487   S32 length = 0;
488
489   for (S32 i = 0; i < directories.size(); i++)
490      length += dStrlen(directories[i]) + 1;
491
492   // Get a return buffer.
493   char* buffer = Con::getReturnBuffer(length);
494   char* p = buffer;
495
496   // Copy the directory names to the buffer.
497   for (S32 i = 0; i < directories.size(); i++)
498   {
499      dStrcpy(p, directories[i], length - (p - buffer));
500      p += dStrlen(directories[i]);
501      // Tab separated.
502      p[0] = '\t';
503      p++;
504   }
505   p--;
506   p[0] = '\0';
507
508   return buffer;
509}
510
511DefineEngineFunction(fileSize, S32, ( const char* fileName ),,
512   "@brief Determines the size of a file on disk\n\n"
513
514   "@param fileName Name and path of the file to check\n"
515   "@return Returns filesize in bytes, or -1 if no file\n"
516
517   "@ingroup FileSystem")
518{
519   Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName);
520   return Platform::getFileSize( sgScriptFilenameBuffer );
521}
522
523DefineEngineFunction( fileModifiedTime, String, ( const char* fileName ),,
524   "@brief Returns a platform specific formatted string with the last modified time for the file.\n\n"
525
526   "@param fileName Name and path of file to check\n"
527   "@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for example\n"
528   "@ingroup FileSystem")
529{
530   Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName);
531
532   FileTime ft = {0};
533   Platform::getFileTimes( sgScriptFilenameBuffer, NULL, &ft );
534
535   Platform::LocalTime lt = {0};
536   Platform::fileToLocalTime( ft, &lt );   
537   
538   String fileStr = Platform::localTimeToString( lt );
539   
540   char *buffer = Con::getReturnBuffer( fileStr.size() );
541   dStrcpy( buffer, fileStr, fileStr.size() );
542   
543   return buffer;
544}
545
546DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),,
547   "@brief Returns a platform specific formatted string with the creation time for the file."
548
549   "@param fileName Name and path of file to check\n"
550   "@return Formatted string (OS specific) containing created time, \"9/3/2010 12:33:47 PM\" for example\n"
551   "@ingroup FileSystem")
552{
553   Con::expandScriptFilename( sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName );
554
555   FileTime ft = {0};
556   Platform::getFileTimes( sgScriptFilenameBuffer, &ft, NULL );
557
558   Platform::LocalTime lt = {0};
559   Platform::fileToLocalTime( ft, &lt );   
560
561   String fileStr = Platform::localTimeToString( lt );
562
563   char *buffer = Con::getReturnBuffer( fileStr.size() );
564   dStrcpy( buffer, fileStr, fileStr.size() );
565
566   return buffer;
567}
568
569DefineEngineFunction(fileDelete, bool, ( const char* path ),,
570   "@brief Delete a file from the hard drive\n\n"
571
572   "@param path Name and path of the file to delete\n"
573   "@note THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.\n"
574   "@return True if file was successfully deleted\n"
575   "@ingroup FileSystem")
576{
577   static char fileName[1024];
578   static char sandboxFileName[1024];
579
580   Con::expandScriptFilename( fileName, sizeof( fileName ), path );
581   Platform::makeFullPathName(fileName, sandboxFileName, sizeof(sandboxFileName));
582
583   return dFileDelete(sandboxFileName);
584}
585
586
587//----------------------------------------------------------------
588
589DefineEngineFunction(fileExt, String, ( const char* fileName ),,
590   "@brief Get the extension of a file\n\n"
591
592   "@param fileName Name and path of file\n"
593   "@return String containing the extension, such as \".exe\" or \"." TORQUE_SCRIPT_EXTENSION "\"\n"
594   "@ingroup FileSystem")
595{
596   const char *ret = dStrrchr(fileName, '.');
597   if(ret)
598      return ret;
599   return "";
600}
601
602DefineEngineFunction(fileBase, String, ( const char* fileName ),,
603   "@brief Get the base of a file name (removes extension and path)\n\n"
604
605   "@param fileName Name and path of file to check\n"
606   "@return String containing the file name, minus extension and path\n"
607   "@ingroup FileSystem")
608{
609
610   S32 pathLen = dStrlen( fileName );
611   FrameTemp<char> szPathCopy( pathLen + 1);
612
613   dStrcpy( szPathCopy, fileName, pathLen + 1 );
614   forwardslash( szPathCopy );
615
616   const char *path = dStrrchr(szPathCopy, '/');
617   if(!path)
618      path = szPathCopy;
619   else
620      path++;
621   dsize_t retLen = dStrlen(path) + 1;
622   char *ret = Con::getReturnBuffer(retLen);
623   dStrcpy(ret, path, retLen);
624   char *ext = dStrrchr(ret, '.');
625   if(ext)
626      *ext = 0;
627   return ret;
628}
629
630DefineEngineFunction(fileName, String, ( const char* fileName ),,
631   "@brief Get only the file name of a path and file name string (removes path)\n\n"
632
633   "@param fileName Name and path of file to check\n"
634   "@return String containing the file name, minus the path\n"
635   "@ingroup FileSystem")
636{
637   S32 pathLen = dStrlen( fileName );
638   FrameTemp<char> szPathCopy( pathLen + 1);
639
640   dStrcpy( szPathCopy, fileName, pathLen + 1 );
641   forwardslash( szPathCopy );
642
643   const char *name = dStrrchr(szPathCopy, '/');
644   if(!name)
645      name = szPathCopy;
646   else
647      name++;
648   dsize_t retLen = dStrlen(name) + 1;
649   char *ret = Con::getReturnBuffer(retLen);
650   dStrcpy(ret, name, retLen);
651   return ret;
652}
653
654DefineEngineFunction(filePath, String, ( const char* fileName ),,
655   "@brief Get the path of a file (removes name and extension)\n\n"
656
657   "@param fileName Name and path of file to check\n"
658   "@return String containing the path, minus name and extension\n"
659   "@ingroup FileSystem")
660{
661   S32 pathLen = dStrlen( fileName );
662   FrameTemp<char> szPathCopy( pathLen + 1);
663
664   dStrcpy( szPathCopy, fileName, pathLen + 1 );
665   forwardslash( szPathCopy );
666
667   const char *path = dStrrchr(szPathCopy, '/');
668   if(!path)
669      return "";
670   U32 len = path - (char*)szPathCopy;
671   char *ret = Con::getReturnBuffer(len + 1);
672   dStrncpy(ret, szPathCopy, len);
673   ret[len] = 0;
674   return ret;
675}
676
677DefineEngineFunction(getWorkingDirectory, String, (),,
678   "@brief Reports the current directory\n\n"
679
680   "@return String containing full file path of working directory\n"
681   "@ingroup FileSystem")
682{
683   return Platform::getCurrentDirectory();
684}
685
686//-----------------------------------------------------------------------------
687
688// [tom, 5/1/2007] I changed these to be ordinary console functions as they
689// are just string processing functions. They are needed by the 3D tools which
690// are not currently built with TORQUE_TOOLS defined.
691
692DefineEngineFunction(makeFullPath, String, ( const char* path, const char* cwd ), ( "", ""),
693   "@brief Converts a relative file path to a full path\n\n"
694
695   "For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n"
696   "@param path Name of file or path to check\n"
697   "@param cwd Optional current working directory from which to build the full path.\n"
698   "@return String containing non-relative directory of path\n"
699   "@ingroup FileSystem")
700{
701   static const U32 bufSize = 512;
702   char *buf = Con::getReturnBuffer(bufSize);
703   Platform::makeFullPathName(path, buf, bufSize, dStrlen(cwd) > 1 ? cwd : NULL);
704   return buf;
705}
706
707DefineEngineFunction(makeRelativePath, String, ( const char* path, const char* to ), ( "", ""),
708   "@brief Turns a full or local path to a relative one\n\n"
709
710   "For example, \"./game/art\" becomes \"game/art\"\n"
711   "@param path Full path (may include a file) to convert\n"
712   "@param to Optional base path used for the conversion.  If not supplied the current "
713   "working directory is used.\n"
714   "@returns String containing relative path\n"
715   "@ingroup FileSystem")
716{
717   return Platform::makeRelativePathName( path, dStrlen(to) > 1 ? to : NULL );
718}
719
720DefineEngineFunction(pathConcat, String, ( const char* path, const char* file), ( "", ""),
721   "@brief Combines two separate strings containing a file path and file name together into a single string\n\n"
722
723   "@param path String containing file path\n"
724   "@param file String containing file name\n"
725   "@return String containing concatenated file name and path\n"
726   "@ingroup FileSystem")
727{
728   static const U32 bufSize = 1024;
729   char *buf = Con::getReturnBuffer(bufSize);
730   Platform::makeFullPathName(file, buf, bufSize, path);
731   return buf;
732}
733
734//-----------------------------------------------------------------------------
735
736DefineEngineFunction(getExecutableName, String, (),,
737   "@brief Gets the name of the game's executable\n\n"
738
739   "@return String containing this game's executable name\n"
740   "@ingroup FileSystem")
741{
742   return Platform::getExecutableName();
743}
744
745//-----------------------------------------------------------------------------
746
747DefineEngineFunction( getMainDotCsDir, String, (),,
748   "@brief Get the absolute path to the directory that contains the main." TORQUE_SCRIPT_EXTENSION " script from which the engine was started.\n\n"
749
750   "This directory will usually contain all the game assets and, in a user-side game installation, will usually be "
751   "read-only.\n\n"
752   "@return The path to the main game assets.\n\n"
753   "@ingroup FileSystem\n")
754{
755   return Platform::getMainDotCsDir();
756}
757
758//-----------------------------------------------------------------------------
759// Tools Only Functions
760//-----------------------------------------------------------------------------
761
762#ifdef TORQUE_TOOLS
763
764//-----------------------------------------------------------------------------
765
766DefineEngineFunction( openFolder, void, ( const char* path ),,
767   "@brief Open the given folder in the system's file manager.\n\n"
768   "@param path full path to a directory.\n\n"
769   "@note Only present in a Tools build of Torque.\n"
770   "@ingroup FileSystem\n")
771{
772   Platform::openFolder( path );
773}
774
775//-----------------------------------------------------------------------------
776
777DefineEngineFunction( openFile, void, ( const char* file ),,
778   "@brief Open the given @a file through the system.  This will usually open the file in its "
779   "associated application.\n"
780   "@param file %Path of the file to open.\n\n"
781   "@note Only present in a Tools build of Torque.\n"
782   "@ingroup FileSystem\n")
783{
784   Platform::openFile( file );
785}
786
787//-----------------------------------------------------------------------------
788
789DefineEngineFunction( pathCopy, bool, ( const char* fromFile, const char* toFile, bool noOverwrite ), ( "", "", true ),
790   "@brief Copy a file to a new location.\n"
791   "@param fromFile %Path of the file to copy.\n"
792   "@param toFile %Path where to copy @a fromFile to.\n"
793   "@param noOverwrite If true, then @a fromFile will not overwrite a file that may already exist at @a toFile.\n"
794   "@return True if the file was successfully copied, false otherwise.\n"
795   "@note Only present in a Tools build of Torque.\n"
796   "@ingroup FileSystem")
797{
798   char qualifiedFromFile[ 2048 ];
799   char qualifiedToFile[ 2048 ];
800   
801   Platform::makeFullPathName( fromFile, qualifiedFromFile, sizeof( qualifiedFromFile ) );
802   Platform::makeFullPathName( toFile, qualifiedToFile, sizeof( qualifiedToFile ) );
803
804   return dPathCopy( qualifiedFromFile, qualifiedToFile, noOverwrite );
805}
806
807//-----------------------------------------------------------------------------
808
809DefineEngineFunction( getCurrentDirectory, String, (),,
810   "@brief Return the current working directory.\n\n"
811   "@return The absolute path of the current working directory.\n\n"
812   "@note Only present in a Tools build of Torque.\n"
813   "@see getWorkingDirectory()"
814   "@ingroup FileSystem")
815{
816   return Platform::getCurrentDirectory();
817}
818
819//-----------------------------------------------------------------------------
820
821DefineEngineFunction( setCurrentDirectory, bool, ( const char* path ),,
822   "@brief Set the current working directory.\n\n"
823   "@param path The absolute or relative (to the current working directory) path of the directory which should be made the new "
824      "working directory.\n\n"
825   "@return True if the working directory was successfully changed to @a path, false otherwise.\n\n"
826   "@note Only present in a Tools build of Torque.\n"
827   "@ingroup FileSystem")
828{
829   return Platform::setCurrentDirectory( StringTable->insert( path ) );
830
831}
832
833//-----------------------------------------------------------------------------
834
835DefineEngineFunction( createPath, bool, ( const char* path ),,
836   "@brief Create the given directory or the path leading to the given filename.\n\n"
837   "If @a path ends in a trailing slash, then all components in the given path will be created as directories (if not already in place).  If @a path, "
838   "does @b 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 "
839   "of the path will be created.\n\n"
840   "@param path The path to create.\n\n"
841   "@note Only present in a Tools build of Torque.\n"
842   "@ingroup FileSystem" )
843{
844   static char pathName[1024];
845
846   Con::expandScriptFilename( pathName, sizeof( pathName ), path );
847
848   return Platform::createPath( pathName );
849}
850
851#endif // TORQUE_TOOLS
852