Filename Tracking System?

Blitz3D Forums/Blitz3D Programming/Filename Tracking System?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

That sounds like a good start, quite a nice idea actually, I have the same problem.

DeepThought, that won't work if you create filenames on the fly or have custom functions to do loading. ie
function loadlevel(filename$)
All of these will never be found.
a$="hello"
b$=".bmp"
for n=1 to 10
image(n) = loadimage a$+n+b$
next
I think Craig has got the idea right of doing it within the code.

Your problem with the associated files isn't a problem as you can get the texture names out of your meshes. Although, quite frankly not sure if it's worth the hassle.

To add more function to it you could have an additonal program that scans all of the files in the working directory and compares it against the trackfile.dat file (see below) to see what differences there are and therefore what files to delete... maybe even add an autodelete option, although with this you'd have to pull the texture names out of your meshes.

Futhermore when checking through the files trackfile it could highlight .BMPs .WAVs etc and suggest coverting these to PNGs or OGGs for example.

I would also change your function a little and add another one that gets called when the program exits.

Global TrackFiles = True

Type TFile
	Field FileName$
End Type

Function TrackFile$(FileName$)
	If Not TrackFiles Then Return
	
	;Check to see if the file is in the TFile list already
	For TF.TFile = Each TFile
		If TF\FileName = FileName Then Return FileName
	Next
	
	; Create a new TFile
	Tf.TFile = New TFile
	Tf\FileName = FileName

	Return FileName
End Function

Function SaveTrackFile(filename$ = "TrackFile.dat")
	fileout = WriteFile (filename)
	For tf.tfile = Each tfile
		WriteString(fileout,tf\filename)
	Next
End Function


Craig, I also deleted the duplicate thread in the showcase