So I am making a game editor and this software interacts with the game engine, So the game editor can create rust projects for you. Currently I am copying the code from the game editor to a project that uses the game engine in order to load up the saved contents from the game editor while you compile from the project.
I know there is a better way to "write once and run everywhere" which is to write a library to do this, So I was wondering where should this library be created? Should I copy the entire library during compile time and during runtime store it under ~/.config/game_editor/ and then that way the individual project can just look for ~/.config/game_editor/ to get hte structures, the functions etc?
Does the library stay the same, even as the game is edited, or does it contain dynamically generated Rust code that depends on what editing you do in the editor?
If you do end up copying the library please use the XDG Base Directory Specification. In this case that would mean using the XDG_DATA_HOME environment variable and falling back on $HOME/.local/share, as opposed to dropping it in .config.
Eventually the game editor itself would be pushed to crates.io so are you saying that I should have a separate library to crates.io, maybe as an extension?
Currently there is no library, it puts some of the files into its own binary and during runtime if creating a new project, it would copy those files to the project's dir.
Interesting mate, should I copy the entire library crate project folder to that specific directory or should i just copy the lib file(s) over?
Edit: Should I even consider having a lib crate or should I just have extra *.rs files and copy them over for the project as well?
Eventually I plan to make it compatible with Windows as well so does Windows have an equivilent directory? If not I could possible make that directory anyways?
I can't really say definitively what to put in $XDG_DATA_HOME/game_editor/, or whether copying files around like that is the right option. The XDG dirs might just be something to remember for next time.
Windows does indeed have an equivalent directory, its %LOCALAPPDATA%. This post has most of the commonly accepted equivalents between windows and XDG dirs.
But in my case, should create a lib crate project inside that directory, or should I have some *.rs files that gets shared between the game editor and any project that is using the game engine?