How to know the dir name of the launched mod ?


(Alan) #1

The lib i am making needs to know in which directory he is.
It can be etmain, foobar, mymod, …
For the moment he reads a file to know that but i am looking for an other solution.
I want to know the fs_game var. “/fs_game” works in the console, but when i use:

	// get the name with fs_game cvar
	char fs_game[MAX_STRING_CHARS];

	trap_Cvar_VariableStringBuffer("fs_game", fs_game, sizeof(fs_game));
	G_Printf ("fs_game=%s
",fs_game);

Et crashes :frowning:

Received signal 11, exiting...

I can not send the console command: “/fs_game” because the mod lib isn’t launched.

Do you have an idea ?

Thanks
Alan


(FREAK!!!) #2

did you try fs_homepath too :wink:


(Calzonzin) #3

fs_homepath is no the path of the currently running mod, it’s one level up (ie, /home/et/ vs /home/et/shrub/ )


(Alan) #4

if i just launch et without “+set fs_game foo”

]/fs_game
"fs_game" is:"^7" default:"^7"
]/fs_homepath
"fs_homepath" is:"/home/alan/.etwolf^7" default:"/home/alan/.etwolf^7"

:disgust: …
Perhaps I should continue with my file.


(Calzonzin) #5

I hate people who ask me this when I ask a question, but why do you need to know?


(Alan) #6

???

I am working on Ubot, and the lib needs to know what is the mod that have been called, to launch it. But to do that he needs to know where he is.
I am using a file in which the dir is written and i wonder if the server can give me this piece of information.


(Calzonzin) #7

It’s not the current directory? Looking at some source, it looks like it’s the current directory.


(Alan) #8

How to know what is the current dir ? I could do a system(“pwd”) or “dir” but it is crappy and i am not sure it will give me the dir i want.


(Alan) #9

When i do trap_FS_FOpenFile it opens files in the mod dir, but when i want to launch the mod i am back in the ET root dir !