C++ Paths

Started by
3 comments, last by Mr_Ridd 19 years, 6 months ago
Hey Say I have a base folder for my game, and in there have a folder called 'utils' and one called g_media. Inside utils there are files like Tools.c/h, Event.h etc. Now if I, for example, load a model from Events.h with the following path, "g_media/models/world/huts/hut_01.3DS" it says that it cannot find the path. It appears as though I need to go back one directory. Surely this isn't the case, won't it start from my base directory? Thanks
The ability to succeed is the ability to adapt
Advertisement
is your default executable directory ../ (relative to the project and source files, I mean)?

does "../g_media/models/world/huts/hut_01.3DS" work?
Yeah I tried that. I'm not sure if it worked because when I tried it it didn't but now that I think about it I might of done something else wrong with other model loading code.

Anyway... do I have to do something like that? Shouldn't it start from the base folder?
The ability to succeed is the ability to adapt
Quote:Original post by Mr_Ridd
Anyway... do I have to do something like that? Shouldn't it start from the base folder?
No. By default it starts from wherever your binary executable is located. As far as the binary is concerned, the source and header files don't exist (and never did).

Create an initialization/configuration file in the same directory as the binary executable (or use a Registry key if you're on Windows) and store all configuration data such as the media files directory in there.
Quote:By default it starts from wherever your binary executable is located


If my binary executable is in my base folder then it should work, shouldn't it?
The ability to succeed is the ability to adapt

This topic is closed to new replies.

Advertisement