Example #1
0
 /// <summary>
 /// Adds the entry to hosts file.
 /// </summary>
 /// <param name="ipaddress">The ipaddress.</param>
 /// <param name="hostname">The hostname.</param>
 private static void AddEntryToHostsFile(String ipaddress,
                                         String hostname)
 {
     if (FdOs.IsWindows())
     {
         using (StreamWriter w = File.AppendText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"drivers\etc\hosts")))
         {
             w.WriteLine($"{ipaddress} {hostname}");
         }
     }
     else if (FdOs.IsLinux())
     {
         DockerHelper.ExecuteBashCommand($"echo {ipaddress} {hostname} | sudo tee -a /etc/hosts");
     }
 }
Example #2
0
 public static bool IsNative()
 {
     return(FdOs.IsLinux());
 }
Example #3
0
 public static bool IsEmulatedNative()
 {
     return(!FdOs.IsLinux() && !IsToolbox());
 }