Verified Commit 395c2ef4 authored by Camil Staps's avatar Camil Staps 🚀

Open HTML file in browser after generation

parent 59d2e47c
...@@ -11,6 +11,7 @@ import System.File ...@@ -11,6 +11,7 @@ import System.File
import System.FilePath import System.FilePath
import System.Options import System.Options
import System.OS import System.OS
import System.Process
import System._Pointer import System._Pointer
from Text import class Text(concat,join), instance Text String, <+ from Text import class Text(concat,join), instance Text String, <+
import qualified Text.HTML import qualified Text.HTML
...@@ -62,6 +63,7 @@ Start w ...@@ -62,6 +63,7 @@ Start w
= exit "Could not open output file" w = exit "Could not open output file" w
# f = write_profile css js profile f # f = write_profile css js profile f
# (_,w) = fclose f w # (_,w) = fclose f w
# w = open_file_in_browser args.output w
= w = w
where where
usage prog = concat usage prog = concat
...@@ -247,3 +249,9 @@ where ...@@ -247,3 +249,9 @@ where
push_a_b 0 push_a_b 0
pop_a 1 pop_a 1
} }
open_file_in_browser :: !String !*World -> *World
open_file_in_browser file w = snd (callProcess open args Nothing w)
where
open = IF_LINUX "xdg-open" (IF_WINDOWS "C:\\Windows\\System32\\cmd.exe" "open")
args = IF_WINDOWS ["/c","start",file] [file]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment