UnixOperatingSystem.st
changeset 20455 893fe6053faf
parent 20454 4b44463a3054
child 20456 b87283a19b7f
equal deleted inserted replaced
20454:4b44463a3054 20455:893fe6053faf
  3813 
  3813 
  3814     |path f fExt commandFilename|
  3814     |path f fExt commandFilename|
  3815 
  3815 
  3816     commandFilename := aCommand asFilename.
  3816     commandFilename := aCommand asFilename.
  3817     commandFilename isAbsolute ifTrue:[
  3817     commandFilename isAbsolute ifTrue:[
       
  3818         "/ something like "/foo/...", tried path is it
  3818         ^ commandFilename pathName
  3819         ^ commandFilename pathName
  3819     ].
  3820     ].
  3820     commandFilename isExplicitRelative ifTrue:[
  3821     commandFilename isExplicitRelative ifTrue:[
       
  3822         "/ something like "../foo/...", tried path resolved relative to the current directory
  3821          ^ commandFilename pathName
  3823          ^ commandFilename pathName
  3822     ].
  3824     ].
  3823     (aCommand includes:$/) ifTrue:[
  3825     (aCommand includes:$/) ifTrue:[
  3824         "/ something like "smalltalk/stx", if executed from a parent directory
  3826         "/ something like "smalltalk/stx", tried path is relative to the current directory
  3825         ^ ('./',aCommand) asFilename pathName
  3827         ^ ('./',aCommand) asFilename pathName
  3826     ].
  3828     ].
  3827 
  3829 
       
  3830     "/ command is a single word, not relative and not absolute.
       
  3831     "/ search along PATH environment variable to see what a shoell would do.
  3828     path := self getEnvironment:'PATH'.
  3832     path := self getEnvironment:'PATH'.
  3829     path notEmptyOrNil ifTrue:[
  3833     path notEmptyOrNil ifTrue:[
  3830         (path asCollectionOfSubstringsSeparatedBy:self pathSeparator) do:[:eachPathComponent |
  3834         (path asCollectionOfSubstringsSeparatedBy:self pathSeparator) do:[:eachPathComponent |
  3831             eachPathComponent isEmpty ifTrue:[
  3835             eachPathComponent isEmpty ifTrue:[
  3832                 f := commandFilename
  3836                 f := commandFilename