mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-22 16:20:19 +01:00
Fix a problem where the global_shell was in a non-existing directory
This commit is contained in:
parent
473d7508c2
commit
3270bb64d0
6 changed files with 11 additions and 10 deletions
|
@ -82,4 +82,5 @@ func careful_delete(path_inside):
|
|||
if path_inside.substr(0,expected_prefix.length()) != expected_prefix:
|
||||
helpers.crash("Refusing to delete directory %s that does not start with %s" % [path_inside, expected_prefix])
|
||||
else:
|
||||
game.global_shell.cd(game.tmp_prefix_inside)
|
||||
game.global_shell.run("rm -rf '%s'" % path_inside)
|
||||
|
|
|
@ -23,6 +23,6 @@ func _ready():
|
|||
game.global_shell.run("git init")
|
||||
game.global_shell.run("git symbolic-ref HEAD refs/heads/main")
|
||||
|
||||
$HSplitContainer/Repository.path = path
|
||||
$Columns/Repository.path = path
|
||||
|
||||
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_2D, SceneTree.STRETCH_ASPECT_KEEP, Vector2(1920, 1080), 1.5)
|
||||
|
|
|
@ -23,7 +23,7 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="."]
|
||||
[node name="Columns" type="HSplitContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 5.0
|
||||
|
@ -34,7 +34,7 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Repository" parent="HSplitContainer" instance=ExtResource( 2 )]
|
||||
[node name="Repository" parent="Columns" instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 949.0
|
||||
|
@ -42,11 +42,11 @@ margin_bottom = 1070.0
|
|||
size_flags_horizontal = 3
|
||||
editable_path = true
|
||||
|
||||
[node name="Terminal" parent="HSplitContainer" instance=ExtResource( 1 )]
|
||||
[node name="Terminal" parent="Columns" instance=ExtResource( 1 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 961.0
|
||||
margin_right = 1910.0
|
||||
margin_bottom = 1070.0
|
||||
size_flags_horizontal = 3
|
||||
repository_path = NodePath("../Repository")
|
||||
repository_path = NodePath("../../Columns/Repository")
|
||||
|
|
4
shell.gd
4
shell.gd
|
@ -13,7 +13,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):
|
||||
func run(command, crash_on_fail=true):
|
||||
var debug = false
|
||||
|
||||
if debug:
|
||||
|
@ -49,7 +49,7 @@ func run(command):
|
|||
#
|
||||
hacky_command = '"\''+hacky_command.replace("'", "'\"'\"'")+'\'"'
|
||||
|
||||
var output = helpers.exec(_shell_binary(), ["-c", hacky_command], false)
|
||||
var output = helpers.exec(_shell_binary(), ["-c", hacky_command], crash_on_fail)
|
||||
|
||||
if debug:
|
||||
print(output)
|
||||
|
|
|
@ -93,7 +93,7 @@ func send_command_async(command):
|
|||
$TCPServer.send(command+"\n")
|
||||
|
||||
func run_command_in_a_thread(command):
|
||||
var o = repository.shell.run(command)
|
||||
var o = repository.shell.run(command, false)
|
||||
check_win_condition()
|
||||
|
||||
input.text = ""
|
||||
|
|
|
@ -21,7 +21,7 @@ func _process(_delta):
|
|||
func open(filename):
|
||||
path = filename
|
||||
|
||||
var fixme_path = game.tmp_prefix_outside+"/active/"
|
||||
var fixme_path = game.tmp_prefix_outside+"/repos/active/"
|
||||
var content = helpers.read_file(fixme_path+filename)
|
||||
text = content
|
||||
|
||||
|
@ -29,7 +29,7 @@ func open(filename):
|
|||
grab_focus()
|
||||
|
||||
func save():
|
||||
var fixme_path = game.tmp_prefix_outside+"/active/"
|
||||
var fixme_path = game.tmp_prefix_outside+"/repos/active/"
|
||||
helpers.write_file(fixme_path+path, text)
|
||||
close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue