What's the deal with CodeBlock::Compile and resManager?
by Stefan Lundmark · in Torque Game Engine · 06/15/2006 (9:52 am) · 0 replies
This is something I do not understand myself.
Many functions in the engine call resManager::openFileForWrite().
CodeBlock::Compile() is one of them, but it does it differently than the others.
To begin with, when openFileForWrite() is called in compile(), it is passed a NULL filename.
openFileForWrite() checks if the fileName is NULL, and returns false, skipping half of the function. See below:
Then compile() checks the return of openFileForWrite() and if it's false, it also returns false and a ton of code beneath that point is never run.
In particular, I'm curious to the comment in the first codeblock. I know the if clause prevents files from being written to the root, but if you change it to this:
Anyone got a clue?
Many functions in the engine call resManager::openFileForWrite().
CodeBlock::Compile() is one of them, but it does it differently than the others.
To begin with, when openFileForWrite() is called in compile(), it is passed a NULL filename.
openFileForWrite() checks if the fileName is NULL, and returns false, skipping half of the function. See below:
if (!file)
return false; // don't allow storing files in rootThen compile() checks the return of openFileForWrite() and if it's false, it also returns false and a ton of code beneath that point is never run.
if(!ResourceManager->openFileForWrite(st, codeFileName))
return false;In particular, I'm curious to the comment in the first codeblock. I know the if clause prevents files from being written to the root, but if you change it to this:
if (!file)
{
file = path;
dStrcpy (path, "");
//return false;
}Which allows files to be written to the root, compile() breaks.Anyone got a clue?
About the author