Initial set of tools for editing/running projects
This commit is contained in:
37
goat/gzdoom.py
Normal file
37
goat/gzdoom.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from . import util
|
||||
|
||||
GZDOOM_PATHS = []
|
||||
SLADE_PATHS = []
|
||||
GZDOOM_PROJECT = "iwadinfo.txt"
|
||||
|
||||
class Project():
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
|
||||
def run(self):
|
||||
subprocess.run([find_gzdoom_command(), "-iwad", "."], cwd=self.path)
|
||||
|
||||
def edit(self):
|
||||
subprocess.run([find_slade_command(), "."], cwd=self.path)
|
||||
|
||||
def find_gzdoom_command():
|
||||
for exe in GZDOOM_PATHS:
|
||||
if os.path.exists(exe):
|
||||
return exe
|
||||
|
||||
return "gzdoom"
|
||||
|
||||
def find_slade_command():
|
||||
for exe in SLADE_PATHS:
|
||||
if os.path.exists(exe):
|
||||
return exe
|
||||
|
||||
return "slade"
|
||||
|
||||
def find_project(path):
|
||||
path = util.find_nearest(path, lambda entry: entry.lower() == GZDOOM_PROJECT)
|
||||
if path is not None:
|
||||
return Project(path)
|
||||
Reference in New Issue
Block a user