public static bool Execute() { string logfile = HugsLibUtility.TryGetLogFilePath(); if (logfile.NullOrEmpty() || !File.Exists(logfile)) { HugsLibController.Logger.ReportException(new FileNotFoundException("Log file path is unknown or log file does not exist. Path:" + logfile)); return(false); } var platform = PlatformUtility.GetCurrentPlatform(); switch (platform) { case PlatformType.Linux: return(Shell.StartProcess(new Shell.ShellCommand { FileName = logfile })); case PlatformType.MacOSX: return(Shell.StartProcess(new Shell.ShellCommand { FileName = "open", Args = logfile })); case PlatformType.Windows: return(Shell.StartProcess(new Shell.ShellCommand { FileName = logfile })); default: HugsLibController.Logger.ReportException(new Shell.UnsupportedPlatformException("ShellOpenLog")); return(false); } }
private string RedactHomeDirectoryPaths(string log) { // not necessary for windows logs if (PlatformUtility.GetCurrentPlatform() == PlatformType.Windows) { return(log); } const string pathReplacement = "[Home_dir]"; var homePath = Environment.GetEnvironmentVariable("HOME"); if (homePath == null) { return(log); } return(log.Replace(homePath, pathReplacement)); }