1- using System . Threading . Tasks ;
1+ using System ;
2+ using System . Threading . Tasks ;
23
34namespace SourceGit . ViewModels
45{
@@ -13,23 +14,23 @@ public Models.CustomAction CustomAction
1314 public ExecuteCustomAction ( Repository repo , Models . CustomAction action )
1415 {
1516 _repo = repo ;
16- _args = action . Arguments . Replace ( "${REPO}" , _repo . FullPath ) ;
17+ _args = action . Arguments . Replace ( "${REPO}" , GetWorkdir ( ) ) ;
1718 CustomAction = action ;
1819 View = new Views . ExecuteCustomAction ( ) { DataContext = this } ;
1920 }
2021
2122 public ExecuteCustomAction ( Repository repo , Models . CustomAction action , Models . Branch branch )
2223 {
2324 _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 ) ;
2526 CustomAction = action ;
2627 View = new Views . ExecuteCustomAction ( ) { DataContext = this } ;
2728 }
2829
2930 public ExecuteCustomAction ( Repository repo , Models . CustomAction action , Models . Commit commit )
3031 {
3132 _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 ) ;
3334 CustomAction = action ;
3435 View = new Views . ExecuteCustomAction ( ) { DataContext = this } ;
3536 }
@@ -51,6 +52,11 @@ public override Task<bool> Sure()
5152 } ) ;
5253 }
5354
55+ private string GetWorkdir ( )
56+ {
57+ return OperatingSystem . IsWindows ( ) ? _repo . FullPath . Replace ( "/" , "\\ " ) : _repo . FullPath ;
58+ }
59+
5460 private readonly Repository _repo = null ;
5561 private string _args = string . Empty ;
5662 }
0 commit comments