mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-30 14:42:26 +03:00
Hide read/write messages behind game.debug flag
This commit is contained in:
parent
f09abe36e9
commit
3460e37d82
7
game.gd
7
game.gd
@ -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)
|
||||
|
4
main.gd
4
main.gd
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user