Hide read/write messages behind game.debug flag

This commit is contained in:
Sebastian Morr 2020-09-08 20:13:49 +02:00
parent f09abe36e9
commit 3460e37d82
3 changed files with 9 additions and 4 deletions

View File

@ -2,13 +2,15 @@ extends Node
var tmp_prefix = "/tmp/"
var global_shell
var debug = false
func _ready():
global_shell = Shell.new()
global_shell.cd(tmp_prefix)
func read_file(path):
print ("reading " + path)
if debug:
print("reading " + path)
var file = File.new()
file.open(path, File.READ)
var content = file.get_as_text()
@ -16,7 +18,8 @@ func read_file(path):
return content
func write_file(path, content):
print ("writing " + path)
if debug:
print("writing " + path)
var file = File.new()
file.open(path, File.WRITE)
file.store_string(content)

View File

@ -87,7 +87,9 @@ func construct_repo(script, path):
shell.run("mkdir " + path)
shell.cd(path)
shell.run("git init")
print(shell.run("source "+script_path))
var output = shell.run("source "+script_path)
if game.debug:
print(output)
func _process(delta):
if server.is_connection_available():

View File

@ -17,7 +17,7 @@ func cd(dir):
# Run a shell command given as a string. Run this if you're interested in the
# output of the command.
func run(command):
var debug = true
var debug = false
if debug:
print("$ %s" % command)