Need help is creating cross platform executable versions
See original GitHub issueHi @Scony ,
I loved your plugin. But I wanted to create a inEditor version plugin of it.
tool
extends EditorPlugin
var files = []
func _ready():
var script_editor := get_editor_interface().get_script_editor()
var filesystem_interface := get_editor_interface().get_resource_filesystem()
var filesystem := filesystem_interface.get_filesystem()
walk_files(filesystem)
print('Scripts: ' + str(files))
for script in files:
var array = [script]
var args = PoolStringArray(array)
OS.execute("/Library/Frameworks/Python.framework/Versions/3.8/bin/gdformat", args, true)
filesystem_interface.update_file(script)
func walk_files(dir: EditorFileSystemDirectory):
for i in range(dir.get_file_count()):
if dir.get_file_type(i) == "GDScript":
files.append(ProjectSettings.globalize_path(dir.get_file_path(i)))
for j in range(dir.get_subdir_count()):
walk_files(dir.get_subdir(j))
The above script works perfectly and it looks through all the GDscripts in the current project directory and then runs the gdformatter against them and then updates the file in Godot.
But as you can see the path to gdformat script is hard coded.
"/Library/Frameworks/Python.framework/Versions/3.8/bin/gdformat"
To resolve this problem I need to create an compiled executable version gdformatter and I can add the compiled version in the plugin directory itself and depending upon OS I can switch the executable and run everything locally so end user does not have to install python/this pacakge.
I tried to create an executable with PyInstaller but it threw a bunch of errors. I am not expert in python so maybe you can help in this regard 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@simonv3 I have created an initial release let me know if you face any issues. Feel free to raise a github issue. https://github.com/vickylance/godot-formatter/releases
I’ll try to help. I’m on holidays ATM. So I’ll take a look in couple days.