-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Make default palettes available for clean installs on MacOS #1008
Make default palettes available for clean installs on MacOS #1008
Conversation
src/Autoload/Global.gd
Outdated
@@ -659,6 +659,8 @@ func _init() -> void: | |||
loaded_locales.sort() # Make sure locales are always sorted | |||
if OS.has_feature("template"): | |||
root_directory = OS.get_executable_path().get_base_dir() | |||
if OS.get_name() == "macOS": | |||
root_directory = "res://" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root_directory
variable is used in other places as well, such as when saving the override.cfg
file which is used to change certain project settings (like embed_subwindows
and per_pixel_transparency
). For this to work, override.cfg
has to be in the same folder as the executable, so I think changing this to "res://" is going to break that functionality, although I could be mistaken, unfortunately I do not own a macOS device to test it.
The reason palettes, brushes and patterns are not bundled inside the application is to allow users to remove or edit the default ones if they don't like them, as well as add new ones. Will this still be possible with this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I did not notice override.cfg
I will have to find a work around for root_directory
.
With regards to the palettes, they remain editable (they are copied to the user://
on start up) but they can not be deleted (if a default palette is deleted, on next start up the palette is restored) which I don't think is functionality we want. However I do think that is a separate bug because if the pixelorama_data
folder was found in the Pixelorama.app/Content/Resources/
this would still be the case.
Regardless, I'll find a work-a-round for the root_directory
then over the weekend I can compare the functionality on my Widows machine and make sure that MacOS functions similarly.
8847560
to
5e2fc3a
Compare
I reverted the changes to the workflows as well as the This resolves the original problem, without affecting This leaves me with a new concerns though: On start up the app will copy the default palettes to the |
Awesome, thank you!
Yeah, I think a new issue should be created for this. Since it doesn't happen on macOS only, it's a general issue and it should be unrelated to this PR and #791. If this PR is ready to get merged, I think I should go ahead and merge it now and we can fix that other issue later. |
I am happy that we merge this. I am also happy to create the issue to track the new default palettes bug. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This PR aims to resolve : 791
On MacOS with a clean install the application is unable to reference the
pixelorama_data
directory in thePixelorama.app/Contents/Resources
directory, this meant thatPalettes.gd
was unable to copy the default palette files to the user directory.The above was cause by 3 issues:
root_directory
inGlobals.dg's _init()
function was set to.
which resolved to the directory of the binary (Pixelorama.app/Contents/macOS/
)is_instance_valid()
seemed to always return false in_get_palette_files()
inPalettes.gd
while running as an exported application (it worked well in the editor.)pixelorama_data
directory being copied to thePixelorama.app/Contents/Resources
directory,DirAccess
would fail toopen
the Resources directory.The solution I have implemented is to set the
root_directory
to "res://" for MacOS, so that it maps to the virtual directory of thePixelorama.pck
file.Check the validity of
dir
in_get_palette_files()
with a null check that should cover both of the previous conditions, eliminating the need foris_instance_valid()
.Then (probably controversially) removed the
.gdignore
file from thepixelorama_data
directory before export of the release builds, this ensure that thepixelorama_data
directory is packed into thePixelorama.pck
file and available at run time.I was unsure why the
.gdignore
file was there to begin with, but I was hesitant to remove it all together incase it interfered with the other platforms, therefore I thought removing it in the automated builds made the most sense, to keep this as a change that purely affects MacOS.