--- a/Win32OperatingSystem.st Fri Jul 09 01:20:27 1999 +0200
+++ b/Win32OperatingSystem.st Fri Jul 09 17:03:21 1999 +0200
@@ -2516,28 +2516,31 @@
|path f fExt|
aCommand asFilename isAbsolute ifTrue:[
- ^ aCommand
+ aCommand asFilename exists ifTrue:[
+ ^ aCommand
+ ].
+ ^ nil
].
path := self getEnvironment:'PATH'.
path notNil ifTrue:[
- (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
- path isEmpty ifTrue:[
- f := aCommand asFilename
- ] ifFalse:[
- f := path asFilename construct:aCommand.
- ].
- self executableFileExtensions do:[:ext |
- ext notEmpty ifTrue:[
- fExt := (f pathName , '.' , ext) asFilename.
- ] ifFalse:[
- fExt := f.
- ].
- fExt isExecutable ifTrue:[
- ^ fExt pathName
- ].
- ].
- ].
+ (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
+ path isEmpty ifTrue:[
+ f := aCommand asFilename
+ ] ifFalse:[
+ f := path asFilename construct:aCommand.
+ ].
+ self executableFileExtensions do:[:ext |
+ ext notEmpty ifTrue:[
+ fExt := (f pathName , '.' , ext) asFilename.
+ ] ifFalse:[
+ fExt := f.
+ ].
+ fExt isExecutable ifTrue:[
+ ^ fExt pathName
+ ].
+ ].
+ ].
].
^ nil
@@ -4454,62 +4457,72 @@
getDomainName
"return the domain this host is in.
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name idx hostName k|
DomainName notNil ifTrue:[
- ^ DomainName
+ ^ DomainName
].
name := self getEnvironment:'DOMAIN'.
name isNil ifTrue:[
- name := self getEnvironment:'DOMAINNAME'.
+ name := self getEnvironment:'DOMAINNAME'.
].
name isNil ifTrue:[
- "/ sometimes, we can extract the domainName from the hostName ...
- hostName := self getHostName.
- hostName notNil ifTrue:[
- idx := hostName indexOf:$..
- idx ~~ 0 ifTrue:[
- name := hostName copyFrom:idx+1.
- ]
- ].
- name isNil ifTrue:[
- "/ ok, search the registry ...
-
- k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System'.
- k notNil ifTrue:[
- k subKeysDo:[:subKey |
- subKey subKeysDo:[:subSubKey |
- |tcp params|
-
- (subSubKey path asLowercase endsWith:'services') ifTrue:[
- tcp := subSubKey subKeyNamed:'tcpip'.
- tcp notNil ifTrue:[
- params := tcp subKeyNamed:'parameters'.
- params notNil ifTrue:[
- name := params valueNamed:'Domain'.
- params close.
- ].
- tcp close.
- ]
- ]
- ]
- ]
- ].
- ].
- name isNil ifTrue:[
- 'Win32OperatingSystem [warning]: cannot find out domainname' errorPrintCR.
- name := 'unknown'.
- ]
+ "/ sometimes, we can extract the domainName from the hostName ...
+ hostName := self getHostName.
+ hostName notNil ifTrue:[
+ idx := hostName indexOf:$..
+ idx ~~ 0 ifTrue:[
+ name := hostName copyFrom:idx+1.
+ ]
+ ].
+ name isNil ifTrue:[
+ "/ ok, search the registry ...
+
+ "/ under NT, it is found there ...
+ k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System'.
+ k notNil ifTrue:[
+ k subKeysDo:[:subKey |
+ subKey subKeysDo:[:subSubKey |
+ |tcp params|
+
+ (subSubKey path asLowercase endsWith:'services') ifTrue:[
+ tcp := subSubKey subKeyNamed:'tcpip'.
+ tcp notNil ifTrue:[
+ params := tcp subKeyNamed:'parameters'.
+ params notNil ifTrue:[
+ name := params valueNamed:'Domain'.
+ params close.
+ ].
+ tcp close.
+ ]
+ ]
+ ]
+ ]
+ ].
+ ].
+ name isNil ifTrue:[
+ "/ under Win95/Win98, it is found there ...
+ k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP'.
+ k notNil ifTrue:[
+ name := k valueNamed:'Domain'.
+ k close.
+ ]
+ ].
+
+ name isNil ifTrue:[
+ 'Win32OperatingSystem [warning]: cannot find out domainname' errorPrintCR.
+ name := 'unknown'.
+ ]
].
DomainName := name.
^ name
"
- OperatingSystem getDomainName
+ DomainName := nil. OperatingSystem getDomainName
OperatingSystem getHostName
"
@@ -5402,6 +5415,38 @@
"/ under windows, the commandName includes the path - good.
sysPath add:(Smalltalk commandName asFilename directoryName).
^ sysPath
+!
+
+stxBinDirPath
+ "ask the registry for the binary directory"
+
+ |k p|
+
+ k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
+ k notNil ifTrue:[
+ p := k valueNamed:'BinDir'
+ ].
+ ^ p
+
+ "
+ OperatingSystem stxBinDirPath
+ "
+!
+
+stxLibDirPath
+ "ask the registry for the lib directory"
+
+ |k p|
+
+ k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
+ k notNil ifTrue:[
+ p := k valueNamed:'LibDir'
+ ].
+ ^ p
+
+ "
+ OperatingSystem stxLibDirPath
+ "
! !
!Win32OperatingSystem class methodsFor:'private'!
@@ -7751,6 +7796,6 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.73 1999-06-23 12:40:39 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.74 1999-07-09 15:03:21 cg Exp $'
! !
Win32OperatingSystem initialize!