Stupid Linux Question...

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.
lethe
Posts: 1
Joined: Wed May 12, 2004 11:32 am

Post by lethe »

hi
when you want to use the icon to start a compiled irrlicht example your have to change your working directory so that the bin can find the meshes and textures to include. Or in another way, you can define your meshes with an absolute not an relative path.

greets

lethe
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

How can I set the working directory? :oops: I feel stupid... :P
________
Yamaha Psr-3000 History
Last edited by disanti on Tue Feb 22, 2011 8:07 am, edited 1 time in total.
Unarekin
Posts: 60
Joined: Thu Apr 22, 2004 11:02 pm

Post by Unarekin »

something like:
device->getFileSystem()->changeWorkingDirectoryTo(directory);
should do ya.
xhrit
Posts: 140
Joined: Mon Jun 14, 2004 8:54 am
Location: earth
Contact:

Post by xhrit »

>Shouldn't Niko make the engine able to load meshes if run from the X-Server instead of the Konsole?

hmmm, it also seems textures are not loaded when the engine is started from konqueror. Does anyone know why this is?
Core2Duo E8400 3.0ghz - 2048mb DDR2 800 - geForce 9600 - Slackware12.1

Word-image-symbol programming limits, controls, and imprisons the individual.
Smash the control images, smash the control machine.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Another one of my old and embarrissing posts brought up! :oops: Lol, anyway, I found a solution to this:

Put this function somewhere in your code:

Code: Select all

/*getLastSpecifiedCharFromString*/
int getLastSpecifiedCharFromString(char* string, int character)
{
	int last = 0, num = 0;
	while(*string != 0x00)
	{
		if(*string == (char)character)
		{
			last = num;
		}
		num++;
		string++;
	}
	return last;
}
Put this where you want to load a file:

Code: Select all

//linux is tricky, we have to make sure Irrlicht knows the path to the file
char path[MAX_PATH];
memset(path, 0x00, sizeof(path));
path = argv[0];
int placeoffilename = getLastSpecifiedCharFromString(path, 0x2F);
memmove(path+placeoffilename,"thefile.zip",8);
window->device->getFileSystem()->addZipFileArchive(path, true, true);
I just wrote this code yesterday and havn't actually tested it so if someone could test it for me it would be WONDERFUL! :) Thanks~ John DiSanti
________
SUZUKI LJ
Post Reply