Skip to content

Commit

Permalink
Path to tool depends on platform
Browse files Browse the repository at this point in the history
  • Loading branch information
JakuJ committed Aug 27, 2024
1 parent 236a916 commit dc27ebc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Raise/Diagnostics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Language.LSP.Server
import Raise.DiagnosticParser (parseRSLTC)
import System.Directory (withCurrentDirectory)
import System.FilePath (takeDirectory, takeFileName)
import System.Info (os)
import System.Process (readProcessWithExitCode)

runTool :: String -> [String] -> FilePath -> IO T.Text
Expand All @@ -26,11 +27,14 @@ runTool tool args path = do
(_, stdout, _) <- readProcessWithExitCode tool (args ++ [file]) ""
pure $ T.pack stdout

rsltcPath :: FilePath
rsltcPath = if os == "mingw32" then "rsltc.exe" else "rsltc"

runChecker :: FilePath -> IO T.Text
runChecker path = runTool "rsltc" [] path
runChecker path = runTool rsltcPath [] path

runCompiler :: FilePath -> IO T.Text
runCompiler path = runTool "rsltc" ["-m"] path
runCompiler path = runTool rsltcPath ["-m"] path

sendDiagnostics :: Bool -> J.NormalizedUri -> FilePath -> LspM () ()
sendDiagnostics compile fileUri filePath = do
Expand Down

0 comments on commit dc27ebc

Please sign in to comment.