OsUtils.cs
1 using System; 2 using System.Diagnostics; 3 using System.Runtime.InteropServices; 4 5 namespace Ryujinx.Common.Utilities 6 { 7 public partial class OsUtils 8 { 9 [LibraryImport("libc", SetLastError = true)] 10 private static partial int setenv([MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string value, int overwrite); 11 12 public static void SetEnvironmentVariableNoCaching(string key, string value) 13 { 14 // Set the value in the cached environment variables, too. 15 Environment.SetEnvironmentVariable(key, value); 16 17 if (!OperatingSystem.IsWindows()) 18 { 19 int res = setenv(key, value, 1); 20 Debug.Assert(res != -1); 21 } 22 } 23 } 24 }