Game Development Community

File size / copy file / ...

by Very Interactive Person · in Torque Game Engine · 06/01/2004 (11:54 am) · 4 replies

Is it possible to do a file size check on a certain file using scripts? I also would like to know if its possible to copy a file (move it from one to another dir).... and last but not least, would it be possible to check if a certain file is an image or not? I don't mean check if it ends with .jpg, but check if it actually contains image data (ok, i don't think its possible, but no harm in asking ;) )

#1
06/01/2004 (2:02 pm)
What are you trying to do? There might be better ways to solve this problem.
#2
06/01/2004 (2:08 pm)
Indeed ;)

I was pulling a jpg file from a webserver to use it as a texture. The problem was if it failed I had an empty jpg file (well it was 4kb, but it was corrupt)...and that crashed the game. But now I built in a check so it no longer writes the file if the download fails... problem solved.
#3
06/01/2004 (10:40 pm)
Sounds like a much better solution. :)
#4
06/01/2004 (11:15 pm)
I still want to know this same feature, if it exists.
Either to check a buffer, or a file on the disc.

Why do I need this? Well, I'm trying the same thing as Ward does - but instead of a tiny JPG it's a Patch.
I'm trying to make a progress bar for it, but haven't found a way to measure the file size of the patch or the buffer, for that matter.