guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor
GNU General Public License v3.0
2.79k stars 223 forks source link

Load global scripts #365

Closed madd-games closed 6 months ago

madd-games commented 6 months ago

Here is my proposal for a system-wide script directory, in additional to the user directory which we already use.

Currently I've set it to /etc/goxel/scripts on Linux, and I'm not sure what it could be on Windows.

This would allow scripts to be installed globally, for example via a Debian package, allowing packages to add fuctionality such as additional import/export formats. So far it was possible to install scripts for a given user but not as part of a package installed on the system.

Let me know what you think

guillaumechereau commented 6 months ago

Why not, though I don't really like the name 'global_dir'. I think what would make sense is to use a single system function to get any kind of directory, maybe with an enum. This would also be useful for the default image saving directory for example. I'll try to have a look later at how other open source projects handle that.

guillaumechereau commented 6 months ago

I added a more generic way to do this with a sys_iter_paths function. Totally untested at the moment, and might break the code on linux or windows.

madd-games commented 6 months ago

Thanks, I have tested it on Linux and it works. This branch is no longer necessary.