#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Wed, 29 Jan 2020 13:30:17 +0100
changeset 25209 8293e76f3a08
parent 25208 864a5cfdbca8
child 25210 672a4cdd0524
#FEATURE by cg class: Win32OperatingSystem::RegistryEntry class added: #defaultValueFor:
Win32OperatingSystem.st
--- a/Win32OperatingSystem.st	Wed Jan 29 00:34:36 2020 +0100
+++ b/Win32OperatingSystem.st	Wed Jan 29 13:30:17 2020 +0100
@@ -1092,7 +1092,6 @@
     "Modified: 7.1.1997 / 19:36:11 / stefan"
 ! !
 
-
 !Win32OperatingSystem class methodsFor:'OS signal constants'!
 
 sigABRT
@@ -16640,6 +16639,24 @@
 
 !Win32OperatingSystem::RegistryEntry class methodsFor:'registry access'!
 
+defaultValueFor:keyPath
+    "convenient accessing method;
+     Looks for the default value under keyPath;
+     returns nil if either not found, or no string value"
+
+    |k|
+
+    k := self key:keyPath.
+    k notNil ifTrue:[^ k defaultValue].
+    ^ nil
+
+    "
+     self defaultValueFor:'HKEY_LOCAL_MACHINE\Software\IronPython\2.7\InstallPath'
+     self defaultValueFor:'HKEY_LOCAL_MACHINE\Software\xxxIronPython\2.7\InstallPath'
+     self defaultValueFor:'xHKEY_LOCAL_MACHINE\Software\xxxIronPython\2.7\InstallPath'
+    "
+!
+
 stringValueFor:valueName atKey:keyPath
     "convenient accessing method;
      Looks for a string value under keyPath;