Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XDG basedir standard on X11 Godot platforms #197

Merged
merged 13 commits into from
Apr 12, 2020

Conversation

sapient-cogbag
Copy link
Contributor

Make Palettes/Brushes get loaded/saved in appropriate locations as specified by the XDG basedir standard, for easier usage of standard linux/bsd packaging methods and for better per-user usability.

@sapient-cogbag
Copy link
Contributor Author

sapient-cogbag commented Apr 11, 2020

I do believe i have successfully got the Palette working nyaa <3

Including the copy-on-write of system palettes in /usr/share/pixelorama/Palette(s), into the user XDG data directory when changed, and an override system :)

@Calinou
Copy link
Contributor

Calinou commented Apr 11, 2020

Why not use the Project Settings Use Custom User Dir property? It should handle everything for you. The Custom User Dir Name can be customized on a per-platform basis using feature tags (so you could have pixelorama on Linux and macOS but Pixelorama on Windows).

@sapient-cogbag
Copy link
Contributor Author

The specific reason for me doing this is so the system handles $XDG_DATA_HOME and $XDG_DATA_DIRS correctly. To my understanding, the Godot setting does not handle them (especially the second one, since it cannot possibly know how to correctly do prioritised/overridable file loading) nya. The first one, again to my understanding, hardcodes it rather than checking the environment variable (though it might not). But one of the key things with this PR is that it means you can store read-only system files in /usr/share or wherever the system configured $XDG_DATA_DIRS, which is important for most packages nyaa.

@Calinou
Copy link
Contributor

Calinou commented Apr 11, 2020

I appreciate the effort, but I still think this is way too much code for something that's best left to the engine 🙁

Do you intend to package Pixelorama for a Linux distribution? Note that there's already a Flatpak available.

@sapient-cogbag
Copy link
Contributor Author

It just doesn't fit with the linux standard now, and as far as i know the engine doesn't handle it properly according to XDG basedir standards () so we just have to do it ourselves ;-;

@sapient-cogbag
Copy link
Contributor Author

(and yes, i am making a PKGBUILD :p)
(this is partially to allow native packages)

…ks as-if the randomised brushes are separated out from all the other brushes in directories nyaaaa ^.^
 into xdg-standard

Getting ourselves up to date with upstream for easy merge! nya ^.^
@sapient-cogbag
Copy link
Contributor Author

Both the Palette and Brushes should now functionally work with xdg basedir standard, with appropriate overriding behaviour ^.^

@sapient-cogbag sapient-cogbag marked this pull request as ready for review April 11, 2020 22:40
@sapient-cogbag sapient-cogbag changed the title WIP: XDG basedir standard on X11 Godot platforms XDG basedir standard on X11 Godot platforms Apr 12, 2020
@OverloadedOrama
Copy link
Member

I've exported it on Windows so far and it works okay. Only problem is that it doesn't work when I run it inside Godot. It should create a pixelorama folder with the Brushes and Palettes folders inside of it, but it doesn't. It does on export though, which is the important part I guess.

The problem in the editor can be fixed if we create a "pixelorama" folder in the repo, and move "Brushes" and "Palettes" there. Could you do that? I think if you do it should be ready to get merged.

@sapient-cogbag
Copy link
Contributor Author

Will do!

@sapient-cogbag
Copy link
Contributor Author

It might be a good idea for me to make it so that when the data directories are empty it adds "res://" to it so it can load from internal data. I don't know if Brushes and Palettes actually get stored in the executable though. nya

@OverloadedOrama
Copy link
Member

Brushes and Palettes don't get stored in the executable, unfortunately. Their existence on the repo is purely to be there for the people that clone it. When I'm exporting the binaries, I'm copying the brushes and palette files manually.

@sapient-cogbag
Copy link
Contributor Author

Cool ^.^
this should be mergable then right :)
nya

@OverloadedOrama
Copy link
Member

Tested it on Ubuntu too. Works as expected. It seems that we can no longer include the Brushes and Palettes into the .zip itself like we used to, since it's loading/saving them elsewhere, so loading them from "res://" is an one-way road now. Probably copying them from res:// to the actual directories, if the directories don't exist. Which is all right, it'll save me some time from putting the files manually myself on every binary I export.

I'll merge it now, and we can figure out loading them from internal data some other time. Thank you!

@OverloadedOrama OverloadedOrama merged commit 0046856 into Orama-Interactive:master Apr 12, 2020
@OverloadedOrama
Copy link
Member

Now that Godot 3.4 has new OS data directory getter methods (godotengine/godot#49732), I wonder if the XDGDataPaths scripts can be simplified, or if it's needed anymore.

@Calinou
Copy link
Contributor

Calinou commented Dec 1, 2021

Now that Godot 3.4 has new OS data directory getter methods (godotengine/godot#49732), I wonder if the XDGDataPaths scripts can be simplified, or if it's needed anymore.

I think the XDG script is no longer needed in 3.4 and later. The built-in methods should provide the same functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants