MCPcopy Create free account
hub / github.com/PowerShell/DSC / set

Method set

tools/dsctest/src/refresh_env.rs:23–36  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

21
22impl RefreshEnv {
23 pub fn set(&self) {
24 #[cfg(windows)]
25 {
26 // Set the environment variable in the registry for current user
27 let hkcu = Hive::CurrentUser.open("Environment", Security::Write).unwrap();
28 let ucstring = UCString::<u16>::from_str(&self.value).unwrap();
29 let data = Data::String(ucstring);
30 hkcu.set_value(&self.name, &data).unwrap();
31 }
32 #[cfg(not(windows))]
33 {
34 // Do nothing on non-Windows
35 }
36 }
37
38 pub fn get(&self) -> RefreshEnv {
39 #[cfg(windows)]

Callers 1

mainFunction · 0.45

Calls 3

set_valueMethod · 0.80
from_strFunction · 0.50
openMethod · 0.45

Tested by

no test coverage detected