1
- using System . Threading . Tasks ;
1
+ using System ;
2
+ using System . Threading . Tasks ;
2
3
3
4
namespace SourceGit . ViewModels
4
5
{
@@ -13,23 +14,23 @@ public Models.CustomAction CustomAction
13
14
public ExecuteCustomAction ( Repository repo , Models . CustomAction action )
14
15
{
15
16
_repo = repo ;
16
- _args = action . Arguments . Replace ( "${REPO}" , _repo . FullPath ) ;
17
+ _args = action . Arguments . Replace ( "${REPO}" , GetWorkdir ( ) ) ;
17
18
CustomAction = action ;
18
19
View = new Views . ExecuteCustomAction ( ) { DataContext = this } ;
19
20
}
20
21
21
22
public ExecuteCustomAction ( Repository repo , Models . CustomAction action , Models . Branch branch )
22
23
{
23
24
_repo = repo ;
24
- _args = action . Arguments . Replace ( "${REPO}" , _repo . FullPath ) . Replace ( "${BRANCH}" , branch . FriendlyName ) ;
25
+ _args = action . Arguments . Replace ( "${REPO}" , GetWorkdir ( ) ) . Replace ( "${BRANCH}" , branch . FriendlyName ) ;
25
26
CustomAction = action ;
26
27
View = new Views . ExecuteCustomAction ( ) { DataContext = this } ;
27
28
}
28
29
29
30
public ExecuteCustomAction ( Repository repo , Models . CustomAction action , Models . Commit commit )
30
31
{
31
32
_repo = repo ;
32
- _args = action . Arguments . Replace ( "${REPO}" , _repo . FullPath ) . Replace ( "${SHA}" , commit . SHA ) ;
33
+ _args = action . Arguments . Replace ( "${REPO}" , GetWorkdir ( ) ) . Replace ( "${SHA}" , commit . SHA ) ;
33
34
CustomAction = action ;
34
35
View = new Views . ExecuteCustomAction ( ) { DataContext = this } ;
35
36
}
@@ -51,6 +52,11 @@ public override Task<bool> Sure()
51
52
} ) ;
52
53
}
53
54
55
+ private string GetWorkdir ( )
56
+ {
57
+ return OperatingSystem . IsWindows ( ) ? _repo . FullPath . Replace ( "/" , "\\ " ) : _repo . FullPath ;
58
+ }
59
+
54
60
private readonly Repository _repo = null ;
55
61
private string _args = string . Empty ;
56
62
}
0 commit comments