Skip to content

Commit

Permalink
Fix FileSystemGitRepository>>commandExists: for Windows
Browse files Browse the repository at this point in the history
Fixes #46.
  • Loading branch information
MariusDoe committed Nov 16, 2024
1 parent 168ba92 commit 0f74282
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
git porcelain - external
commandExists: aString
^ ((self osProcessClass: #ShellSyntax) new
findExecutablePathFor: (aString copyUpTo: Character space)
inDirectoryPath: nil) notNil
| 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]]
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 0f74282

Please sign in to comment.