Hello, i’d like to know how to get the path to the current executable folder.
Sadly the expression “FileSystem::ExecutablePath()” gives the path to the current game executable, but i’d like to know how to point to the folder, so instead of:
it would give me
If it is of any help, im on ubuntu 18.10, currently i didn’t make a game build and i tested the expression within gdevelop. It returned:
But that last “gdevelop” is actually the executable, it should have returned:
why don’t you remove all behind the last / ?
that should be the Path
Honestly… because i’m not sure how to do that?
Just to be clear, i don’t want to keep it hardcoded, i could simply use the string “/home/lubuntu/Desktop/Documents/gdevelop” but in case i change the folder or a player has a different path i want the game to automatically pick it up.
The main reason to why i need it right now is to test the JSON data files i have without worrying about changing the path before exporting the game. I could use a documents folder or temporary, but i’d like to keep it all in the game folder.
But i’m not sure how to do that in gdevelop.
it shouldn’t be hard with string manipulation function. I used to do it a lot as much system apis give you full execurable path look for last / and get substring before it.
If not able use an easy path like c:\mygame and inform the User in the game
take a look here, is it possible with these functions
Took a quick look at it and i’m sure that yes, this will work indeed!
Thank you! I honestly didn’t even know about these.
My bad for skipping basic documentation, thank you for having the patience to point me to the right direction.
But just another quick question, if i export this game on multiple platforms i’d have to search for “/” on linux and " \ " on windows right?
I get the feeling that something is wrong here, according to the documentation:
" This games executable folder
This expression returns the operating system independent path to the folder where your game is being executed from."
It should return the folder, however it return the executable. Maybe it is because on linux there’s no extension to the executable, maybe it is because i haven’t compiled the game. But anyway, i will bother myself with that later, thanks for all the help!
Hi I think it will use / in all systems as says operating system independent path, but I don’t konw sorry