Example #1
0
 internal static void SetEnvironmentVariables()
 {
     NativeUtility.SetEnvironmentVariables();
     // TOCHECK: was the following deliberate?
     //switch (Environment.OSVersion.Platform)
     //{
     //   case PlatformID.Win32NT:
     //      Environment.SetEnvironmentVariable("PATH", FindRPathFromRegistry());
     //      break;
     //}
 }
        public static void SetupPath()
        {
            // as of 2013-10, there is a helper that should work for all platforms:
            NativeUtility.SetEnvironmentVariables();
            // The following sample code is left as a fallback option if you have unforeseen issues,
            // but you should report issues on the R.NET discussion list.
//            var oldPath = System.Environment.GetEnvironmentVariable("PATH");
//            var rPath = System.Environment.Is64BitProcess ? @"C:\Program Files\R\R-3.0.2\bin\x64" : @"C:\Program Files\R\R-3.0.2\bin\i386";
//            if (Directory.Exists(rPath) == false)
//                throw new DirectoryNotFoundException(string.Format("Could not found the specified path to the directory containing R.dll: {0}", rPath));
//            var newPath = string.Format("{0}{1}{2}", rPath, System.IO.Path.PathSeparator, oldPath);
//            System.Environment.SetEnvironmentVariable("PATH", newPath);
        }
Example #3
0
 /// <summary>
 /// Perform the necessary setup for the PATH and R_HOME environment variables.
 /// </summary>
 /// <param name="rPath">The path of the directory containing the R native library.
 /// If null (default), this function tries to locate the path via the Windows registry, or commonly used locations on MacOS and Linux</param>
 /// <param name="rHome">The path for R_HOME. If null (default), the function checks the R_HOME environment variable. If none is set,
 /// the function uses platform specific sensible default behaviors.</param>
 /// <remarks>
 /// This function has been designed to limit the tedium for users, while allowing custom settings for unusual installations.
 /// </remarks>
 public static void SetEnvironmentVariables(string rPath = null, string rHome = null)
 {
     environmentIsSet = true;
     NativeUtility.SetEnvironmentVariables(rPath: rPath, rHome: rHome);
 }