From 5ac3523817b67aff7ff41ef5a9121a00f672ba3e Mon Sep 17 00:00:00 2001 From: bleeptrack Date: Wed, 9 Sep 2020 13:25:00 +0200 Subject: [PATCH] Hardcoded windows paths for testing --- game.gd | 14 ++++---------- main.gd | 3 ++- shell.gd | 5 ++--- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/game.gd b/game.gd index 4a7a1ec..d745bdb 100644 --- a/game.gd +++ b/game.gd @@ -9,9 +9,9 @@ func _ready(): global_shell = Shell.new() # Copy fake-editor to tmp directory (because the original might be in a .pck file). - var fake_editor = tmp_prefix + "fake-editor" + fake_editor = tmp_prefix + "fake-editor" var content = game.read_file("res://scripts/fake-editor") - write_file(fake_editor, content) + write_file('C:\\Users\\1\\AppData\\Local\\Temp\\fake-editor', content) global_shell.run("chmod u+x " + fake_editor) func read_file(path): @@ -34,11 +34,5 @@ func write_file(path, content): func _tmp_prefix(): var os = OS.get_name() - - if os == "X11": - return "/tmp/" - elif os == "Windows": - return "%temp%/" - else: - push_error("Unsupported OS") - get_tree().quit() + return "/tmp/" + diff --git a/main.gd b/main.gd index 7a119b7..ac0b10e 100644 --- a/main.gd +++ b/main.gd @@ -81,7 +81,7 @@ func construct_repo(script, path): # the script somewhere in the filesystem. var content = game.read_file(script) var script_path = game.tmp_prefix+"/git-hydra-script" - game.write_file(script_path, content) + game.write_file('C:\\Users\\1\\AppData\\Local\\Temp\\git-hydra-script', content) game.global_shell.run("mkdir " + path) game.global_shell.cd(path) @@ -93,6 +93,7 @@ func construct_repo(script, path): func _process(_delta): if server.is_connection_available(): + print("Client connected") client_connection = server.take_connection() read_commit_message() diff --git a/shell.gd b/shell.gd index fe61223..b8904dc 100644 --- a/shell.gd +++ b/shell.gd @@ -2,7 +2,6 @@ extends Node class_name Shell var _cwd -var _fake_editor signal output(text) @@ -21,7 +20,7 @@ func run(command): print("$ %s" % command) var env = {} - env["EDITOR"] = _fake_editor + env["EDITOR"] = game.fake_editor var hacky_command = "" for variable in env: @@ -72,7 +71,7 @@ func run_async_thread(command): # Run a simple command with arguments, blocking, using OS.execute. func _exec(command, args=[]): - var debug = false + var debug = true if debug: print("exec: %s [%s]" % [command, PoolStringArray(args).join(", ")])