PATH, relative paths, runtime creation - and problems

Posted By: Error014

PATH, relative paths, runtime creation - and problems - 04/25/15 18:33

Hello all!

I'm having trouble with PATH-statements. I used to have lots of trouble with those (basically: they did not work), gave up and simply gave the needed relative path everywhere, like so

Code:
ent_create("Models\\tile.mdl",...



But that makes working with warn_level=3 impossible. So I tried it again, and then it worked. For reference, this is my .wdl-file

Code:
PATH "Tiles";
PATH "Models";
PATH "Sprites";
PATH "Sounds";
PATH "HUD";


PLUGINDIR "Plugins";



Sidenote: The manual-example for PLUGINDIR uses an equal-sign, but the Plugins ACTUALLY seem to work


So I changed all paths so the code above would look like

Code:
ent_create("tile.mdl",...



And everything was well.


Until recently. Out of nowhere, the PATH-statements again stopped working. If I re-add the local paths (like in the first code-bit), it works. And the PATH-statements are taken into account for directly defined stuff, such as something like

Code:
BMAP* selectormap = "selector.bmp";



But anything I create at runtime only works if I add the subdirectory to the filename. No matter if bmap_create or ent_create.


I can't use PRAGMA_PATH, because that doesn't work with the published version, and I need it to work there.
"add_path" changed nothing.

I know that the .wdl-file is read, since without it the direct definitions wouldn't work (and I can tell from what plugins are read).

Reading out work_dir implies that I am in the correct folder, so that "Tiles" and the others are actually the subfolders there.


What am I doing wrong?
Posted By: Error014

Re: PATH, relative paths, runtime creation - and problems - 04/25/15 23:16

add_path works, actually! My mistake. I didn't realize add_new resets those, apparently also including the PATH-instructions!
Posted By: Superku

Re: PATH, relative paths, runtime creation - and problems - 04/26/15 01:06

Good to know!
Posted By: FBL

Re: PATH, relative paths, runtime creation - and problems - 05/24/15 20:34

and you have a maximum of I think 30 PATH statements.

Considering resourcing I found out that using relative pathes everywhere can become pretty painful. Relative pathes allow multiple files with the same name - a resource doesn't. Not so much fun to hunt down such problems without knowing what you're actually searching for.
© 2024 lite-C Forums