mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-03 19:04:40 +01:00
Changes for OSX
This commit is contained in:
parent
c3066b4560
commit
8501e598a4
7 changed files with 16 additions and 10 deletions
|
@ -11,7 +11,7 @@ func update():
|
|||
var root_item = $FileTree.create_item()
|
||||
root_item.set_text(0, "FILES")
|
||||
|
||||
var file_string = shell.run("find -type f")
|
||||
var file_string = shell.run("find . -type f")
|
||||
var files = file_string.split("\n")
|
||||
files = Array(files)
|
||||
# The last entry is an empty string, remove it.
|
||||
|
@ -28,7 +28,7 @@ func _on_item_selected():
|
|||
var item = $FileTree.get_selected()
|
||||
var file_path = item.get_text(0)
|
||||
|
||||
shell.run("%s/fake-editor-noblock %s" % [game.tmp_prefix_inside, file_path])
|
||||
shell.run("'%s'/fake-editor-noblock '%s'" % [game.tmp_prefix_inside, file_path])
|
||||
|
||||
func very_best_sort(a,b):
|
||||
# We're looking at the third character because all entries have the form
|
||||
|
|
4
game.gd
4
game.gd
|
@ -53,13 +53,13 @@ func copy_file_to_game_env(filename):
|
|||
var file_inside = tmp_prefix_inside + filename
|
||||
var content = helpers.read_file("res://scripts/"+filename)
|
||||
helpers.write_file(file_outside, content)
|
||||
global_shell.run("chmod u+x " + file_inside)
|
||||
global_shell.run("chmod u+x " + '"'+file_inside+'"')
|
||||
return file_inside
|
||||
|
||||
func _tmp_prefix_inside():
|
||||
var os = OS.get_name()
|
||||
var path
|
||||
if os == "X11":
|
||||
if os == "X11" or os == "OSX":
|
||||
path = OS.get_user_data_dir()
|
||||
elif os == "Windows":
|
||||
helpers.crash("Need to figure out Windows tmp_prefix_inside...")
|
||||
|
|
|
@ -75,6 +75,8 @@ func careful_delete(path_inside):
|
|||
|
||||
if os == "X11":
|
||||
expected_prefix = "/home/%s/.local/share/git-hydra/tmp/" % OS.get_environment("USER")
|
||||
elif os == "OSX":
|
||||
expected_prefix = "/Users/%s/Library/Application Support/git-hydra/tmp/" % OS.get_environment("USER")
|
||||
elif os == "Windows":
|
||||
helpers.crash("Need to figure out delete_prefix on Windows")
|
||||
else:
|
||||
|
|
2
level.gd
2
level.gd
|
@ -77,7 +77,7 @@ func construct():
|
|||
# Make sure that active_repository is in a temporary directory.
|
||||
helpers.careful_delete(repo.path)
|
||||
|
||||
game.global_shell.run("mkdir " + repo.path)
|
||||
game.global_shell.run("mkdir '%s'" % repo.path)
|
||||
game.global_shell.cd(repo.path)
|
||||
game.global_shell.run("git init")
|
||||
game.global_shell.run("git symbolic-ref HEAD refs/heads/main")
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use IO::Socket;
|
||||
use File::Spec;
|
||||
|
||||
$socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
|
||||
PeerPort => 1234,
|
||||
Proto => "tcp",
|
||||
Type => SOCK_STREAM);
|
||||
|
||||
my $absolute_path = File::Spec->rel2abs($ARGV[0]);
|
||||
|
||||
# Send the length of the first argument as a byte.
|
||||
$socket->send(chr(length($ARGV[0])));
|
||||
$socket->send(chr(length($absolute_path)));
|
||||
# Send the first argument as a string.
|
||||
$socket->send($ARGV[0]);
|
||||
$socket->send($absolute_path);
|
||||
|
||||
# This call is intended to block, we're waiting for Godot to close the connection.
|
||||
my $reply;
|
||||
|
|
5
shell.gd
5
shell.gd
|
@ -20,7 +20,8 @@ func run(command, crash_on_fail=true):
|
|||
print("$ %s" % command)
|
||||
|
||||
var env = {}
|
||||
env["GIT_EDITOR"] = game.fake_editor
|
||||
if game.fake_editor:
|
||||
env["GIT_EDITOR"] = game.fake_editor.replace(" ", "\\ ")
|
||||
env["GIT_AUTHOR_NAME"] = "You"
|
||||
env["GIT_COMMITTER_NAME"] = "You"
|
||||
env["GIT_AUTHOR_EMAIL"] = "you@example.com"
|
||||
|
@ -59,7 +60,7 @@ func run(command, crash_on_fail=true):
|
|||
func _shell_binary():
|
||||
var os = OS.get_name()
|
||||
|
||||
if os == "X11":
|
||||
if os == "X11" or os == "OSX":
|
||||
return "bash"
|
||||
elif os == "Windows":
|
||||
return "dependencies\\windows\\git\\bin\\bash.exe"
|
||||
|
|
|
@ -202,7 +202,7 @@ func generate_completions(command):
|
|||
# Part2: Prevent autocompletion to only show filename at the beginning of a command.
|
||||
if !(command.substr(0,4) == "git " and command.split(" ").size() <= 2) and command.split(" ").size() > 1:
|
||||
var last_word = Array(command.split(" ")).pop_back()
|
||||
var file_string = repository.shell.run("find -type f")
|
||||
var file_string = repository.shell.run("find . -type f")
|
||||
var files = file_string.split("\n")
|
||||
files = Array(files)
|
||||
# The last entry is an empty string, remove it.
|
||||
|
|
Loading…
Reference in a new issue