feature: supports to open repository directly from commandline on Linux

This commit is contained in:
leo 2024-05-20 15:15:08 +08:00
parent 8d6481c694
commit 8d726656dc
3 changed files with 3 additions and 3 deletions

0
build/build.linux.sh Normal file → Executable file
View file

View file

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
exec /opt/sourcegit/sourcegit exec /opt/sourcegit/sourcegit $1

View file

@ -35,14 +35,14 @@ namespace SourceGit.ViewModels
var commandlines = Environment.GetCommandLineArgs(); var commandlines = Environment.GetCommandLineArgs();
if (commandlines.Length == 2) if (commandlines.Length == 2)
{ {
var path = commandlines[1].Replace('\\', '/'); var path = commandlines[1];
var root = new Commands.QueryRepositoryRootPath(path).Result(); var root = new Commands.QueryRepositoryRootPath(path).Result();
if (string.IsNullOrEmpty(root)) if (string.IsNullOrEmpty(root))
{ {
Pages[0].Notifications.Add(new Models.Notification Pages[0].Notifications.Add(new Models.Notification
{ {
IsError = true, IsError = true,
Message = $"Given path: '{commandlines[1]}' is NOT a valid repository!" Message = $"Given path: '{path}' is NOT a valid repository!"
}); });
return; return;
} }