diff --git a/app/src/gambas3/.src/VersionControl/CVersionControlGit.class b/app/src/gambas3/.src/VersionControl/CVersionControlGit.class index dbd284700..932be1524 100644 --- a/app/src/gambas3/.src/VersionControl/CVersionControlGit.class +++ b/app/src/gambas3/.src/VersionControl/CVersionControlGit.class @@ -63,7 +63,8 @@ Public Sub Check() As Boolean If $bHasGit Then - sResult = RunShell("git status --porcelain .project") + 'sResult = RunShell("git status --porcelain .project") + Exec ["git", "status", "--porcelain", Project.Dir &/ ".project"] To sResult If Process.LastValue Then $bCanInit = True @@ -76,7 +77,9 @@ Public Sub Check() As Boolean sRoot = FindRoot() If sRoot Then $sRoot = File.Dir(sRoot) - $bHasRemote = RunShell("git remote show") + '$bHasRemote = RunShell("git remote show") + Exec ["git", "remote", "show"] To sResult + $bHasRemote = Trim(sResult) Return True Endif Endif diff --git a/app/src/gambas3/.src/VersionControl/CVersionControlSubversion.class b/app/src/gambas3/.src/VersionControl/CVersionControlSubversion.class index b01f47903..4252904f6 100644 --- a/app/src/gambas3/.src/VersionControl/CVersionControlSubversion.class +++ b/app/src/gambas3/.src/VersionControl/CVersionControlSubversion.class @@ -46,7 +46,7 @@ Public Sub Check() As Boolean Dim sResult As String Dim sDir As String - Shell "readlink -f " & Shell$(Project.Dir) To $sRealDir + Exec ["readlink", "-f", Project.Dir] To $sRealDir $sRealDir = Trim($sRealDir) Init() @@ -56,24 +56,25 @@ Public Sub Check() As Boolean $bCanControl = False If $bSvn17 Then - sResult = VersionControl.Shell("svn status " & Shell$(SvnPath$($sRealDir) &/ ".project") & " 2>&1") + 'sResult = VersionControl.Shell("svn status " & Shell$(SvnPath$($sRealDir) &/ ".project") & " 2>&1") + Exec ["svn", "status", SvnPath$($sRealDir) &/ ".project"] To sResult With Error If Process.LastValue = 0 And If sResult Not Like "svn:*W155007*:*" And If sResult Not Like "svn:*W155010*:*" Then Return True Else - If Exist($sRealDir &/ ".svn") Then Return True + If IsDir($sRealDir &/ ".svn") Then Return True Endif If $bSvn17 Then sDir = $sRealDir Do sDir = File.Dir(sDir) - If Exist(sDir &/ ".svn") Then + If IsDir(sDir &/ ".svn") Then $bCanControl = True Break Endif If sDir = "/" Then Break Loop Else - $bCanControl = Exist($sRealDir &/ "../.svn") + $bCanControl = IsDir($sRealDir &/ "../.svn") Endif Endif diff --git a/app/src/gambas3/.src/VersionControl/VersionControl.module b/app/src/gambas3/.src/VersionControl/VersionControl.module index d15ee53c8..1d7bd8a4e 100644 --- a/app/src/gambas3/.src/VersionControl/VersionControl.module +++ b/app/src/gambas3/.src/VersionControl/VersionControl.module @@ -131,21 +131,26 @@ Public Sub Shell(sCmd As String, Optional bSilent As Boolean, Optional aEnv As S End - -' Public Sub Exec(aCmd As String[], Optional bSilent As Boolean, Optional aEnv As String[]) As String -' -' Dim sResult As String -' -' If Not bSilent Then Insert(aCmd.Join(" ") & "\n") -' Exec aCmd With aEnv To sResult -' If Process.LastValue Then -' $sLastResult = sResult -' Insert(sResult) -' Endif -' Return sResult -' -' End - +Public Sub Exec(aCmd As String[], Optional bSilent As Boolean, Optional aEnv As String[]) As String + + Dim sResult As String + Dim sArg As String + + If Not bSilent Then + For Each sArg In aCmd + If InStr(sArg, " ") Then sArg = Quote(sArg) + Insert(sArg) + Next + Insert("\n") + Endif + Exec aCmd With aEnv To sResult + If Process.LastValue Then + $sLastResult = sResult + Insert(sResult) + Endif + Return sResult + +End Public Sub Run(aCmd As String[], Optional bIdent As Boolean, Optional bOutput As Boolean, Optional aEnv As String[]) As Integer