habamax / vim-godot

Use vim and godot engine to make games

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RunGodot command opens another instance of the Godot app (MacOS Catalina)

opened this issue · comments

Because of how MacOS apps are packaged, my executable is set as such:

let g:godot_executable = '/Applications/Godot.app/Contents/MacOS/Godot'

So when I do :RunGodot, it opens a new instance of Godot (specifically, the project manager) but also runs the game in the background.

Do I have something set wrong? Is this just a dumb MacOS issue?

Do I have something set wrong? Is this just a dumb MacOS issue?

I don't know for sure. I don't have anything mac at the moment so I can't test it and make it work.

See:

elseif has("mac") " XXX: need test

At the moment it basically runs (with you setup) open /Applications/Godot.app/Contents/MacOS/Godot SceneName.tscn

You can play with the source and if you find proper command to run it let me know :)

Related to #28

Check if removing these 2 lines help:

elseif has("mac") " XXX: need test
call system('open ' . godot_command)

Hmm...I guess I made an unfounded assumption that I would need the entire executable path -- not true. Setting my executable variable as shown below fixed the problem:

g:godot_executable = "/Applications/Godot.app"

It would seem that the open manual says you should use the -a argument to specify what application to use when opening the file. Something like:

open -a /Applications/Godot.app path/to/scene.tscn

...however, this might just be best practice. I tested all the commands with the new variable (save for the FZF option as I don't have it installed) and it worked as I would've expected.

I'd suggest an update to documentation at the very least just so no one else makes the assumption I have.

@miltsghostrehab thx for the info. I will add this to the docs.