Fix hls-metadata for windows

This commit is contained in:
2022-03-13 00:28:34 +01:00
parent 4c23f6a49e
commit 9d2ebcb74d
5 changed files with 87 additions and 13 deletions

View File

@@ -18,6 +18,8 @@ import GHCup.Utils
import Codec.Archive
import Control.DeepSeq
import Control.Exception ( evaluate )
import Control.Exception.Safe hiding ( handle )
import Control.Monad
import Control.Monad.IO.Class
@@ -82,12 +84,14 @@ generateHLSGhc format output = do
, ArchiveResult
] $ do
fp <- liftE $ downloadCached dli Nothing
files <- liftE $ getArchiveFiles fp
let regex = makeRegexOpts compExtended execBlank ([s|^haskell-language-server-([0-9]+\.)*([0-9]+)$|] :: ByteString)
filesL <- liftE $ getArchiveFiles fp
files <- liftIO $ evaluate $ force filesL
let regex = makeRegexOpts compExtended execBlank ([s|^haskell-language-server-([0-9]+\.)*([0-9]+)(\.exe)?$|] :: ByteString)
let ghcs = rights $ MP.parse version' ""
. T.pack
. fromJust
. stripPrefix "haskell-language-server-"
. stripExe
<$> filter (match regex) files
pure ghcs
pure r
@@ -98,7 +102,11 @@ generateHLSGhc format output = do
StdOut -> liftIO $ BSL.putStr w
FileOutput f -> liftIO $ BSL.writeFile f w
pure ExitSuccess
where
stripExe :: String -> String
stripExe f = case reverse f of
('e':'x':'e':'.':r) -> reverse r
_ -> f
generateTable :: ( MonadFail m
, MonadMask m

View File

@@ -170,7 +170,7 @@ main = do
, fancyColors = not no_color
}
dirs <- liftIO getAllDirs
let leanAppstate = LeanAppState (Settings True 0 False Never Curl True GHCupURL False GPGNone False) dirs defaultKeyBindings loggerConfig
let leanAppstate = LeanAppState (Settings True 0 False Never Curl True GHCupURL False GPGNone True) dirs defaultKeyBindings loggerConfig
pfreq <- (
flip runReaderT leanAppstate . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] $ platformRequest
@@ -180,7 +180,7 @@ main = do
flip runReaderT leanAppstate $ logError $ T.pack $ prettyShow e
liftIO $ exitWith (ExitFailure 2)
let appstate = AppState (Settings True 0 False Never Curl True GHCupURL False GPGNone False) dirs defaultKeyBindings (GHCupInfo mempty mempty mempty) pfreq loggerConfig
let appstate = AppState (Settings True 0 False Never Curl True GHCupURL False GPGNone True) dirs defaultKeyBindings (GHCupInfo mempty mempty mempty) pfreq loggerConfig
let withValidateYamlOpts vopts f = case vopts of
ValidateYAMLOpts { vInput = Nothing } ->

View File

@@ -49,6 +49,7 @@ executable ghcup-gen
, base >=4.13 && <5
, bytestring ^>=0.10
, containers ^>=0.6
, deepseq ^>=1.4
, filepath ^>=1.4.2.1
, ghcup ^>=0.1.17.3
, haskus-utils-variant ^>=3.2