mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
fix: use \
as path delim on Windows when executing custom actions (#1077)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
cdae9168ed
commit
e65cb50495
1 changed files with 10 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Threading.Tasks;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SourceGit.ViewModels
|
namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -13,7 +14,7 @@ namespace SourceGit.ViewModels
|
||||||
public ExecuteCustomAction(Repository repo, Models.CustomAction action)
|
public ExecuteCustomAction(Repository repo, Models.CustomAction action)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
_args = action.Arguments.Replace("${REPO}", _repo.FullPath);
|
_args = action.Arguments.Replace("${REPO}", GetWorkdir());
|
||||||
CustomAction = action;
|
CustomAction = action;
|
||||||
View = new Views.ExecuteCustomAction() { DataContext = this };
|
View = new Views.ExecuteCustomAction() { DataContext = this };
|
||||||
}
|
}
|
||||||
|
@ -21,7 +22,7 @@ namespace SourceGit.ViewModels
|
||||||
public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Branch branch)
|
public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Branch branch)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
_args = action.Arguments.Replace("${REPO}", _repo.FullPath).Replace("${BRANCH}", branch.FriendlyName);
|
_args = action.Arguments.Replace("${REPO}", GetWorkdir()).Replace("${BRANCH}", branch.FriendlyName);
|
||||||
CustomAction = action;
|
CustomAction = action;
|
||||||
View = new Views.ExecuteCustomAction() { DataContext = this };
|
View = new Views.ExecuteCustomAction() { DataContext = this };
|
||||||
}
|
}
|
||||||
|
@ -29,7 +30,7 @@ namespace SourceGit.ViewModels
|
||||||
public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Commit commit)
|
public ExecuteCustomAction(Repository repo, Models.CustomAction action, Models.Commit commit)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
_args = action.Arguments.Replace("${REPO}", _repo.FullPath).Replace("${SHA}", commit.SHA);
|
_args = action.Arguments.Replace("${REPO}", GetWorkdir()).Replace("${SHA}", commit.SHA);
|
||||||
CustomAction = action;
|
CustomAction = action;
|
||||||
View = new Views.ExecuteCustomAction() { DataContext = this };
|
View = new Views.ExecuteCustomAction() { DataContext = this };
|
||||||
}
|
}
|
||||||
|
@ -51,6 +52,11 @@ namespace SourceGit.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetWorkdir()
|
||||||
|
{
|
||||||
|
return OperatingSystem.IsWindows() ? _repo.FullPath.Replace("/", "\\") : _repo.FullPath;
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Repository _repo = null;
|
private readonly Repository _repo = null;
|
||||||
private string _args = string.Empty;
|
private string _args = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue