Initial set of tools for editing/running projects
This commit is contained in:
29
goat/godot.py
Normal file
29
goat/godot.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from . import util
|
||||
|
||||
GODOT_PATHS = ["C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe"]
|
||||
GODOT_PROJECT = "project.godot"
|
||||
|
||||
class Project():
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
|
||||
def run(self):
|
||||
subprocess.run(find_command(), cwd=self.path)
|
||||
|
||||
def edit(self):
|
||||
subprocess.run([find_command(), "--editor"], cwd=self.path)
|
||||
|
||||
def find_command():
|
||||
for exe in GODOT_PATHS:
|
||||
if os.path.exists(exe):
|
||||
return exe
|
||||
|
||||
return "godot"
|
||||
|
||||
def find_project(path):
|
||||
path = util.find_nearest(path, lambda entry: entry.lower() == GODOT_PROJECT)
|
||||
if path is not None:
|
||||
return Project(path)
|
||||
Reference in New Issue
Block a user