/// <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"); } }
public static bool IsNative() { return(FdOs.IsLinux()); }
public static bool IsEmulatedNative() { return(!FdOs.IsLinux() && !IsToolbox()); }