Skip to content

Instantly share code, notes, and snippets.

@kMutagene
Last active May 27, 2020 06:24
Show Gist options
  • Save kMutagene/f2bab3c532952420a2708c692d3bd022 to your computer and use it in GitHub Desktop.
Save kMutagene/f2bab3c532952420a2708c692d3bd022 to your computer and use it in GitHub Desktop.
#r "nuget: System.Runtime.InteropServices.RuntimeInformation"
///Choose process to open plots with depending on OS. Thanks to @zyzhu for hinting at a solution (https://github.com/muehlhaus/FSharp.Plotly/issues/31)
let openOsSpecificFile path =
if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then
let psi = new System.Diagnostics.ProcessStartInfo(FileName = path, UseShellExecute = true)
System.Diagnostics.Process.Start(psi) |> ignore
elif RuntimeInformation.IsOSPlatform(OSPlatform.Linux) then
System.Diagnostics.Process.Start("xdg-open", path) |> ignore
elif RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then
System.Diagnostics.Process.Start("open", path) |> ignore
else
invalidOp "Not supported OS platform"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment