Skip to content

Commit

Permalink
fix: support workingsubdiroverride
Browse files Browse the repository at this point in the history
  • Loading branch information
imLinguin committed Aug 7, 2024
1 parent 55287cd commit 7715c20
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nile/utils/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self):
self.version = str()
self.command = str()
self.arguments = list()
self.cwd = str()

@classmethod
def parse(cls, game_path, path, unknown_arguments):
Expand All @@ -32,6 +33,10 @@ def parse(cls, game_path, path, unknown_arguments):
instruction.command = os.path.join(game_path, json_data["Main"]["Command"].replace("\\", os.sep))
instruction.arguments = json_data["Main"].get("Args") or list()
instruction.arguments.extend(unknown_arguments)
instruction.cwd = game_path
working_dir_override = json_data["Main"].get("WorkingSubdirOverride")
if working_dir_override:
instruction.cwd = os.path.join(game_path, working_dir_override.replace("\\", os.sep))
return instruction


Expand Down Expand Up @@ -189,7 +194,7 @@ def start(self, game_path):
if result == -1:
print("PR_SET_CHILD_SUBREAPER is not supported by your kernel (Linux 3.4 and above)")

process = subprocess.Popen(command, cwd=game_path, env=self.env)
process = subprocess.Popen(command, cwd=instruction.cwd, env=self.env)
process_pid = process.pid

def iterate_processes():
Expand Down Expand Up @@ -255,7 +260,7 @@ def reap_children():


else:
process = subprocess.Popen(command, cwd=game_path, env=self.env)
process = subprocess.Popen(command, cwd=instruction.cwd, env=self.env)
status = process.wait()

sys.exit(status)

0 comments on commit 7715c20

Please sign in to comment.