dumpConsoleFunctions(); returns these:
/*! Returns the first file in the directory system matching the given pattern. */
virtual string findFirstFile(string pattern) {}
/*! Returns the next file matching a search begun in findFirstFile. */
virtual string findNextFile(string pattern) {}
/*! returns the number of files in the directory tree that match the given pattern */
virtual int getFileCount(string pattern) {}
(...)
virtual bool isFile(fileName) {}
(...)
virtual bool isWriteableFileName(fileName) {}
virtual string fileExt(fileName) {} (Space Guy: Returns extension i.e. ".cs" of file name)
virtual string fileBase(fileName) {} (Returns file string i.e. "Weapon_Gun.cs")
virtual string fileName(filePathName) {} (Returns file name i.e. "Weapon_Gun")
virtual string filePath(fileName) {} (Retunrs file path i.e. "Add-ons" or "Add-ons/client"
function getFiles()
{
%arrayCount = 0;
%array[0] = "";
%file = findFirstFile("Add-Ons/*.cs");
echo("****Begin File Loading****");
if(%file $= ""){error("ERROR: No Files. Aborting...");return;}
while(%file !$= "")
{
%array[%arrayCount++] = %file;
%file = findNextFile("Add-Ons/*.cs");
echo(%file," (",fileName(%file),")");
}
echo("****End File Loading****");
}
Loops through all of Add-Ons finding any .cs file. An array, "%array[%arrayCount]" is made. Anything you want to do with the files has to be in this function because %array is erased after the function ends.
The array contains things like:
Add-Ons/Weapon_Gun.cs
The echo();s will return:
****Begin File Loading****
Add-Ons/Weapon_Gun.cs (Weapon_Gun.cs)
Add-Ons/Client/RPGBinds.cs (RPGBinds.cs)
****End File Loading****