From 51d180016a4681d0f44ddf1138694699785b50a0 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 30 Sep 2015 18:18:49 -0500 Subject: [PATCH] (GH-420) Environment adapter Add SetEnvironmentVariable --- .../infrastructure/adapters/Environment.cs | 5 +++ .../infrastructure/adapters/IEnvironment.cs | 32 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure/adapters/Environment.cs b/src/chocolatey/infrastructure/adapters/Environment.cs index 5013454ccb..de030bb1d6 100644 --- a/src/chocolatey/infrastructure/adapters/Environment.cs +++ b/src/chocolatey/infrastructure/adapters/Environment.cs @@ -38,5 +38,10 @@ public string NewLine { get { return System.Environment.NewLine; } } + + public void SetEnvironmentVariable(string variable, string value) + { + System.Environment.SetEnvironmentVariable(variable, value); + } } } \ No newline at end of file diff --git a/src/chocolatey/infrastructure/adapters/IEnvironment.cs b/src/chocolatey/infrastructure/adapters/IEnvironment.cs index 476868b6cf..1abb1042eb 100644 --- a/src/chocolatey/infrastructure/adapters/IEnvironment.cs +++ b/src/chocolatey/infrastructure/adapters/IEnvironment.cs @@ -62,7 +62,37 @@ public interface IEnvironment /// /// 1 string NewLine { get; } + + /// + /// Creates, modifies, or deletes an environment variable stored in the current process. + /// + /// + /// The name of an environment variable. + /// + /// + /// A value to assign to . + /// + /// + /// is null. + /// + /// + /// contains a zero-length string, an initial hexadecimal zero character (0x00), or an equal sign ("="). + /// -or- + /// The length of or is greater than or equal to 32,767 characters. + /// -or- + /// An error occurred during the execution of this operation. + /// + /// + /// The caller does not have the required permission to perform this operation. + /// + /// 1 + /// + /// + /// + void SetEnvironmentVariable(string variable, string value); } // ReSharper restore InconsistentNaming -} \ No newline at end of file +}