Win32OperatingSystem.st
changeset 20560 7c0bb20fc110
parent 20559 2352d3ac7b76
child 20562 d41673799706
--- a/Win32OperatingSystem.st	Thu Oct 06 19:17:16 2016 +0200
+++ b/Win32OperatingSystem.st	Thu Oct 06 20:52:30 2016 +0200
@@ -3563,8 +3563,8 @@
     |shell args wDir cmdName path|
 
     aCommandString isNonByteCollection ifTrue:[
-        "easy: the caller does not want a shell to be executed"
-        ^ Array with:aCommandString first with:(aCommandString asStringWith:' ') with:nil.
+	"easy: the caller does not want a shell to be executed"
+	^ Array with:aCommandString first with:(aCommandString asStringWith:' ') with:nil.
     ].
 
     "/
@@ -3590,52 +3590,52 @@
     cmdName := (aCommandString ? '') withoutSeparators.
 
     (cmdName isEmpty or:[cmdName includesAny:'<>|']) ifFalse:[
-        "/ test whether the command is a plain executable;
-        "/ if so, no shell is required
-        |index file suffix|
-
-        index := cmdName indexOfSeparatorStartingAt:1.
-        index ~~ 0 ifTrue:[
-            cmdName := cmdName copyFrom:1 to:(index-1).
-            args := cmdName copyFrom:(index+1).
-        ] ifFalse:[
-            args := ''.
-        ].
-
-        (cmdName first = $" and:[cmdName last = $"]) ifTrue:[
-            cmdName := (cmdName copyFrom:2 to:cmdName size - 1) withoutSeparators.
-        ].
-        file := cmdName asFilename.
-        file suffix isEmpty ifTrue:[
-            file := file withSuffix:'exe'.
-        ].
-        path := file fullAlternativePathName.
-        (OperatingSystem getBinaryType:path) notNil ifTrue:[
-            "/ is an executable, no shell required
-            ^ Array with:path with:aCommandString with:nil.
+	"/ test whether the command is a plain executable;
+	"/ if so, no shell is required
+	|index file suffix|
+
+	index := cmdName indexOfSeparatorStartingAt:1.
+	index ~~ 0 ifTrue:[
+	    cmdName := cmdName copyFrom:1 to:(index-1).
+	    args := cmdName copyFrom:(index+1).
+	] ifFalse:[
+	    args := ''.
+	].
+
+	(cmdName first = $" and:[cmdName last = $"]) ifTrue:[
+	    cmdName := (cmdName copyFrom:2 to:cmdName size - 1) withoutSeparators.
+	].
+	file := cmdName asFilename.
+	file suffix isEmpty ifTrue:[
+	    file := file withSuffix:'exe'.
+	].
+	path := file fullAlternativePathName.
+	(OperatingSystem getBinaryType:path) notNil ifTrue:[
+	    "/ is an executable, no shell required
+	    ^ Array with:path with:aCommandString with:nil.
 "/                ^ Array with:path with:(path, ' ', args).
-        ].
-        path := self pathOfCommand:cmdName.
-        (path notNil and:[(OperatingSystem getBinaryType:path) notNil]) ifTrue:[
-            "/ is an executable, no shell required
-            ^ Array with:path with:aCommandString with:nil.
+	].
+	path := self pathOfCommand:cmdName.
+	(path notNil and:[(OperatingSystem getBinaryType:path) notNil]) ifTrue:[
+	    "/ is an executable, no shell required
+	    ^ Array with:path with:aCommandString with:nil.
 "/                ^ Array with:path with:(path, ' ', args).
-        ].
+	].
     ].
 
     shell := self getEnvironment:'COMSPEC'.
     shell isNil ifTrue:[
-        wDir := self getWindowsSystemDirectory asFilename.
-        shell := #('cmd.exe' 'command.com') detect:[:eachCommand|
-                        (wDir / eachCommand) isExecutableProgram
-                    ] ifNone:[
-                        self error:'no cmd.exe available'.
-                    ].
-        shell := (wDir / shell) pathName.
+	wDir := self getWindowsSystemDirectory asFilename.
+	shell := #('cmd.exe' 'command.com') detect:[:eachCommand|
+			(wDir / eachCommand) isExecutableProgram
+		    ] ifNone:[
+			self error:'no cmd.exe available'.
+		    ].
+	shell := (wDir / shell) pathName.
     ].
 
     cmdName isEmpty ifTrue:[
-        ^ Array with:shell with:nil with:nil.
+	^ Array with:shell with:nil with:nil.
     ].
 
     ^ Array with:shell with:(' /c "' , aCommandString, '"') with:false.
@@ -3818,54 +3818,54 @@
 
     cmdFile := aCommand asFilename.
     cmdFile isAbsolute ifTrue:[
-        path isExecutableProgram ifTrue:[
-            ^ aCommand
-        ].
-        ^ nil
+	cmdFile isExecutableProgram ifTrue:[
+	    ^ aCommand
+	].
+	^ nil
     ].
 
     (aCommand includes:Filename separator) ifTrue:[
-        path := Filename currentDirectory construct:aCommand.
-        path isExecutableProgram ifTrue:[
-            ^ path pathName.
-        ].
-        ^ nil
+	path := Filename currentDirectory construct:aCommand.
+	path isExecutableProgram ifTrue:[
+	    ^ path pathName.
+	].
+	^ nil
     ].
 
     "search in all directories of PATH.
      If there no extension, add the known extensions."
     path := (self getEnvironment:'PATH') ? ''.
     (rentry := self registryEntry key: 'HKEY_CURRENT_USER\Environment') notNil ifTrue:[
-        rpath := rentry valueNamed: 'PATH'.
-        rpath notNil ifTrue:[
-            path := path , self pathSeparator , rpath
-        ].
+	rpath := rentry valueNamed: 'PATH'.
+	rpath notNil ifTrue:[
+	    path := path , self pathSeparator , rpath
+	].
     ].
     path := '.;', path.
     hasSuffix := cmdFile suffix notEmpty.
 
     (path asCollectionOfSubstringsSeparatedBy:self pathSeparator) do:[:eachDirectory |
-        |file|
-
-        eachDirectory isEmpty ifTrue:[
-            file := cmdFile
-        ] ifFalse:[
-            file := eachDirectory asFilename construct:aCommand.
-        ].
-        hasSuffix ifTrue:[
-            file isExecutableProgram ifTrue:[
-                ^ file pathName.
-            ].
-        ] ifFalse:[
-            self executableFileExtensions do:[:ext |
-                |fExt|
-
-                fExt := file withSuffix:ext.
-                fExt isExecutableProgram ifTrue:[
-                    ^ fExt pathName.
-                ].
-            ].
-        ].
+	|file|
+
+	eachDirectory isEmpty ifTrue:[
+	    file := cmdFile
+	] ifFalse:[
+	    file := eachDirectory asFilename construct:aCommand.
+	].
+	hasSuffix ifTrue:[
+	    file isExecutableProgram ifTrue:[
+		^ file pathName.
+	    ].
+	] ifFalse:[
+	    self executableFileExtensions do:[:ext |
+		|fExt|
+
+		fExt := file withSuffix:ext.
+		fExt isExecutableProgram ifTrue:[
+		    ^ fExt pathName.
+		].
+	    ].
+	].
     ].
     ^ nil