Game Development Community

GetFileCount() problem ( not refreshing the count no.)

by Playware · in Torque Game Builder · 09/09/2008 (7:53 pm) · 5 replies

Hi All,

I am working on project, in which I am using list box of all user profile exists in one game directory. Each user has seprate file by its user's name. So List box is showing all existing user list. Now I create one Delete Button, by which I have to delete selected user from List Box and user file from directory as well. Then remove deleted user name from shown listBox by using removeRowByID() and its working fine for more than two user in the list.


Actual problem start here. If I press delete on last two user list, its not deleting from listbox. Even I am tring to see total number of user exist in user directory, so it is showing complete users number , when it started the screen. (e.g. - It showing 5 users in listbox from starting and by using getFileCount(), it is also showing 5. Now I deleted three users already by removeRowByID() and again I used getFileCount() from same directory to see total number of user exist now after deleting three. But It is still showing 5 users. It it should show 2 only, because I deleted 3 already. and its keep showing 5 value of getFileCount().


What could be the problem? Is it not refreshing the something memory buffer or something else?


Any idea?


thnaks,

#1
09/09/2008 (8:39 pm)
You need to do something like refreshresmanager to get torque to rebuild the file/resource tree.. that's how it works for me in TGE anyway :)
#2
09/09/2008 (9:00 pm)
I believe that you need to purge and refresh the resource folder. I think you need to do something like:

// Find the full path of the folder
%userFolder = expandFileName(...);
 
// Purge the resources
purgeResources();
 
// Refresh the resource path
addResPath(%userFolder);
#3
09/09/2008 (11:12 pm)
Hi Philip,

After purgeResources() and addResPath() , problem is still same. (e.g. Suppose I deleted user file named "david" from folder out of other five user files. But it is still showing "David" file in the list and total no of files is 6, and in folder only five files are ther aftre deleting.



Any idea?



thnx.
#4
09/09/2008 (11:31 pm)
Ahhhhh, I belive you have encountered the fileDelete() bug in TGB! Basically, the file exists in your AppData folder, but fileDelete() doesn't remove it.

I think it has already been logged into JIRA, if not I'll log it tonight for the devs to address.

Sorry about all the trouble Haider!
#5
09/10/2008 (12:41 am)
Thanks for your time Phillip.


Lets see if we can get some help from other users also.



thnx.