Game Development Community

ResourceManager->openStream() not working. Help :-(

by Ben Carnes · in Torque Game Engine · 04/01/2004 (5:34 pm) · 8 replies

It fails to find a file when I try to use this
ResourceManager->openStream(const char ...)
What am I doing wrong?

I know the file path I am giving this function is correct. For example:
ResourceManager->openStream("~/data/skies/day_sky.dml")

#1
04/01/2004 (7:32 pm)
I'm just trying to read a text file using ResourceManager. ResourceManager->openStream(...) works fine in other TGE code. I don't know why I can't get it to work.
#2
04/02/2004 (8:20 am)
Do you get any errors? What does the function return? Does it expect a StringTableEntry?
#3
04/02/2004 (9:46 am)
The function returns NULL and without generating errors.

I looked at the code in sky.cc which also uses ResourceManager->openStream. sky.cc is very simple and straghtforward in its use of this function, so I can't figure out why it fails in my code.

I am going to try tinkering with sky.cc to see if I can break it in the way my code is broken.
#4
04/02/2004 (4:05 pm)
You may want to try expanding the filename. I'm just guessing but I don't think the resource manager would like ~/ and ./ and so on.
#5
04/03/2004 (12:28 pm)
Good thought, Daniel.
#6
04/03/2004 (12:34 pm)
Just thinking aloud here. Could it also maybe be a "modpath" problem? IE when Torque starts up it scans and builds a list of all "resources" (for lack of a better word.. scripts, guis, textures, models, etc, etc) that are located within the specified mod paths. Any attempt to ADD a file after that point (Lets say you are running your game and decided to make a new script file to test something, but don't restart) will result in it beiung unable to find that file. You have to reset the mod paths search so it "sees" the new files.

Did I just make it more confusing?
#7
04/04/2004 (9:55 am)
The resource I am using exists when the the mod path is set, so that's not the problem. I think the problem may be in the way I specify the filename, as Daniel suggested.

I will post my findings when I get back to work on it on Tuesday. Thanks
#8
04/06/2004 (2:05 pm)
Ahah! Stupid mistake. Got it working :-)

The stream path should look something like this:

demo/data/skies/sky_day.dml