Game Development Community

FindFirstFile

by Howard Dortch · in Torque Game Engine · 09/28/2005 (10:37 am) · 4 replies

Does findFirstFile get the last file aphabeticly in the directory first? If so is there a way to make it do acending?

I have a list of files and get it like so

for(%file = findFirstFile($Server::MissionFileSpec); %file !$= ""; %file = findNextFile($Server::MissionFileSpec))
{
SM_missionList.addRow(%i++, getMissionInfoString(%file) @ "\t" @ %file );
echo("on Wake "@getMissionInfoString(%file) @ "\t" @ %file);

This echo prints the names of the files from Z to A

#1
09/28/2005 (10:54 am)
You could load them into an array and then cycle them backwards :)
#2
09/28/2005 (11:05 am)
SM_missionList is an array of sorts since I can index them.

Another quirk is the SM_missionList::onSelect function, seems the top listing is a higher number than the last listing. If I have 4 items in the list and I select the top one which I assume is 0 or 1 depending on how you look at it it returns a 4 as the row value.
#3
09/28/2005 (11:12 am)
Hmm, if I remember correctly a list has a row value and an ID value (among a text one)... the id value is a specified one upon entering the data...



you might want to try

ConsoleMethod( GuiTextListCtrl, sort, void, 3, 4, "(int columnID, bool increasing=false)"
              "Performs a standard (alphabetical) sort on the values in the specified column.")
#4
09/28/2005 (11:48 am)
Yeah I do this

SM_missionList.sort(0,true);