Relative Path [1/2 SOLVED]

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
MynithiX
Posts: 26
Joined: Thu Oct 11, 2012 4:06 pm
Location: Germany

Relative Path [1/2 SOLVED]

Post by MynithiX »

Hi,
I'm back with a new newbie question ;)
My program is in a folder, and in the same folder their is a media folder, for the files.
So that means, I can get relative in the media folder from my program like this: ./media/File.xxx
In the media folder, their is a file called rocket.obj, and of course I want to load it in my Scene. But when I load it relative

Code: Select all

IAnimatedMesh* mesh = smgr->getMesh("./media/rocket.obj"); 
and compile + start it via Terminal, the output is:
Irrlicht Engine version 1.7.3
Linux 3.2.0-26-generic-pae #41-Ubuntu SMP Thu Jun 14 16:45:14 UTC 2012 i686
Creating X window...
Using plain X visual
Visual chosen: : 33
Could not load mesh, because file could not be opened: : ./media/rocket.obj

But when I make the path absolute, it works. But of course I want to have the path relative, because it's better when I want to give someone else the program...

Thanks
MynithiX
Last edited by MynithiX on Wed Oct 24, 2012 7:55 am, edited 1 time in total.
Two things are infinite: the stupidity of the humans and universe. I'm just not sure if the universe is really infinite!
YOLO
MynithiX
Posts: 26
Joined: Thu Oct 11, 2012 4:06 pm
Location: Germany

Re: Relative Path

Post by MynithiX »

The problem is halsolved now :D
It works when I write ../folder/media/file.xxx
But I want to know why this thing with ./media/file.xxx doesn't work o.O
Two things are infinite: the stupidity of the humans and universe. I'm just not sure if the universe is really infinite!
YOLO
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Relative Path [1/2 SOLVED]

Post by hybrid »

Well, obviously your working directory after starting the app is different to the main directory that you expect it to be.
Post Reply