diff --git a/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/commandExists..st b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/commandExists..st index 0748d652..df18b43a 100644 --- a/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/commandExists..st +++ b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/commandExists..st @@ -1,5 +1,12 @@ git porcelain - external commandExists: aString - ^ ((self osProcessClass: #ShellSyntax) new - findExecutablePathFor: (aString copyUpTo: Character space) - inDirectoryPath: nil) notNil \ No newline at end of file + | command pathDelimiter locations shellSyntax | + command := aString copyUpTo: Character space. + pathDelimiter := self osProcess isWindows ifTrue: [';'] ifFalse: [':']. + locations := (self osProcess thisOSProcess path splitBy: pathDelimiter) + collect: [:each | (FileSystem disk referenceTo: each) / command]. + self osProcess isWindows ifTrue: [ + locations := locations gather: [:each | {each. each withExtension: 'exe'}]]. + shellSyntax := (self osProcessClass: #ShellSyntax) new. + ^ locations anySatisfy: [:each | + each exists and: [shellSyntax isExecutable: each printString]] \ No newline at end of file diff --git a/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json b/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json index 77720641..03984fad 100644 --- a/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json +++ b/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json @@ -10,7 +10,7 @@ "cloneExternalFrom:" : "mad 11/10/2024 16:45", "cloneFrom:" : "mad 11/10/2024 15:45", "cloneInternalFrom:" : "mad 5/23/2024 18:11", - "commandExists:" : "mad 11/10/2024 17:23", + "commandExists:" : "mad 11/16/2024 18:03", "commitNamed:" : "jr 8/13/2020 23:08", "createBranchNamed:at:" : "jr 3/4/2020 00:47", "detectTerminalCommand" : "mad 10/31/2024 17:49",