Skip to content

Commit

Permalink
Use xdg-open to view files on linux
Browse files Browse the repository at this point in the history
And get os form System.Info
  • Loading branch information
gdetrez committed Feb 9, 2016
1 parent 4151096 commit fffcead
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion query-converter/Design.hs
Expand Up @@ -74,7 +74,7 @@ tex6 = getERDiagram [
displayER e = do
writeFile "er-tmp.dot" $ prERDiagram e
system "fdp -Tpng er-tmp.dot >er-tmp.png" -- dot or neato sometimes better
system $ pngviewer os ++ " er-tmp.png"
system $ viewer ++ " er-tmp.png"
putStrLn $ prSchema $ erdiagram2schema SER e -- only E-R strategy implemented; OO and Null TODO
putStrLn ""
putStrLn $ erdiagram2text e
Expand Down
2 changes: 1 addition & 1 deletion query-converter/QConv.hs
Expand Up @@ -117,7 +117,7 @@ alg2latex env s = case pTable (preprocSQL (myLexer s)) of
"\\end{document}"
]
system "pdflatex qconv-latex-tmp.tex > //dev//null"
system $ pdfviewer os ++ " qconv-latex-tmp.pdf"
system $ viewer ++ " qconv-latex-tmp.pdf"
return ()

mintex = "qconv-latex-tmp.tex"
Expand Down
16 changes: 5 additions & 11 deletions query-converter/Viewer.hs
@@ -1,15 +1,9 @@
module Viewer where

-- for viewing E-R designs and relational algebra files

-- select your OS
os = "mac"
-- os = "linux"
import System.Info (os)

pngviewer os = case os of
"mac" -> "open"
"linux" -> "eog"
-- for viewing E-R designs and relational algebra files

pdfviewer os = case os of
"mac" -> "open"
"linux" -> "evince"
viewer = case os of
"darwin" -> "open"
"linux" -> "xdg-open"

0 comments on commit fffcead

Please sign in to comment.