question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need help is creating cross platform executable versions

See original GitHub issue

Hi @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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vickylancecommented, Aug 14, 2020

@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

1reaction
Sconycommented, Apr 27, 2020

I’ll try to help. I’m on holidays ATM. So I’ll take a look in couple days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application publishing - .NET | Microsoft Learn
Executables aren't cross-platform. They're specific to an operating system and CPU architecture. When publishing your app and creating an ...
Read more >
How To Build Go Executables for Multiple Platforms on ...
In this tutorial, you'll use Go's tools to obtain a package from version control and automatically install its executable. Then you'll manually ...
Read more >
How to make a single, cross-platform EXE file in Python 3.7
For Python 3.7, you need to apply the bugfix described in this answer by hand to your local cx_Freeze installation until a corrected...
Read more >
Cross-platform software
In computing, cross-platform software is computer software that is designed to work in several computing platforms. Some cross-platform software requires a ...
Read more >
Cross Platform Compilation of C++ .exe
2 · I am already building the binaries for each platform and distributing those - this takes time and money to do. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found