hascar 0.2.0.1 → 0.2.0.2
raw patch · 5 files changed
+31/−17 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +9/−5
- app/Main.hs +12/−5
- app/Options.hs +5/−5
- hascar.cabal +1/−1
- src/Codec/Archive/SAPCAR/FlatedFile.hs +4/−1
README.md view
@@ -30,6 +30,7 @@ started to learn haskell when he embarked on implementing that algorithm :-) => Some work on this has been done; more is required.+* Implement CRC checking # Performance @@ -51,10 +52,11 @@ # nixos -Users of [nixos](https://nixos.org) can simply install hascar by issuing "nix-env -iaP haskellPackages.hascar".-You need to be subscribed to the unstable channel at this time.+Users of [nixos](https://nixos.org) can simply install hascar by issuing+"nix-env -iaP haskellPackages.hascar". Or if you only need it temporarily, open+a nix-shell like this: "nix-shell -p haskellPackages.hascar" -# Windows/GNU Linux/FreeBSD/OSX+# FreeBSD/GNU_Linux/OS X/Windows To compile and install, first [get stack]( http://docs.haskellstack.org/en/stable/README/), then issue:@@ -87,8 +89,10 @@ # Usage -Run hascar with the -h flag to get help. Basically, the usage should be the-same as with SAP(R)'s sapcar tool.+Run hascar with the -h flag to get help. The basic usage should be the+same as with SAP(R)'s sapcar tool. It should be noted that the used+command line parser is a bit more strict than what you might be used+to. # Example run:
app/Main.hs view
@@ -24,6 +24,7 @@ import Control.Monad import Control.Monad.IO.Class import Data.Binary.Get+import Foreign.C.Types (CTime(..)) import Path import System.Directory import System.Environment@@ -41,11 +42,11 @@ #ifndef mingw32_HOST_OS import System.Posix.Files as SPF #endif-import System.Posix.Types (CMode(..))+import System.Posix.Types (CMode(..), EpochTime(..)) -- |Main entry point main :: IO ()-main = runWithHeader it+main = run it it :: Options -> IO () it options = withSapCarFile (oFilename options) $ do@@ -67,17 +68,23 @@ liftIO $ do createDirectoryIfMissing True $ fromRelDir dirname #ifndef mingw32_HOST_OS- SPF.setFileMode (fromRelDir dirname) $ CMode $ cfPermissions dir+ SPF.setFileMode (fromRelDir dirname) $ CMode $+ fromIntegral $ cfPermissions dir+ let amTime = CTime $ fromIntegral $ cfTimestamp dir+ SPF.setFileTimes (fromRelDir dirname) amTime amTime #endif forM_ files $ \file -> do filename <- parseRelFile $ T.unpack $ carEntryFilename file liftIO $ cdim $ fromRelFile filename when (oVerbose options) $- liftIO $ putStrLn $ "Extracting " ++ show filename+ liftIO $ putStrLn $ "x " ++ fromRelFile filename writeToFile file filename #ifndef mingw32_HOST_OS- liftIO $ SPF.setFileMode (fromRelFile filename) $ CMode $ cfPermissions file+ liftIO $ SPF.setFileMode (fromRelFile filename) $ CMode $+ fromIntegral $ cfPermissions file+ let amTime = CTime $ fromIntegral $ cfTimestamp file+ liftIO $ SPF.setFileTimes (fromRelFile filename) amTime amTime #endif
app/Options.hs view
@@ -1,7 +1,7 @@ module Options ( Options(..) , run- , runWithHeader+ , run' ) where import Control.Monad@@ -25,11 +25,11 @@ oListEntries :: !Bool } deriving (Show) -runWithHeader :: (Options -> IO a) -> IO a-runWithHeader o = run (\l -> unless (oQuiet l) putGpl >> o l)- run :: (Options -> IO a) -> IO a-run = (>>=) (execParser spec)+run o = run' (\l -> unless (oQuiet l) putGpl >> o l)++run' :: (Options -> IO a) -> IO a+run' = (>>=) (execParser spec) spec :: ParserInfo Options spec = info (helper <*> optionsParser)
hascar.cabal view
@@ -1,5 +1,5 @@ name: hascar-version: 0.2.0.1+version: 0.2.0.2 synopsis: Decompress SAPCAR archives description: Decompress SAPCAR archives homepage: https://github.com/VirtualForgeGmbH/hascar
src/Codec/Archive/SAPCAR/FlatedFile.hs view
@@ -158,7 +158,10 @@ | otherwise = return () -- |Decompress one or more lzh compressed blocks-decompressBlocks :: Int -> BS.ByteString -> BS.ByteString+decompressBlocks+ :: Int -- ^ The size of the decompressed result. (Must be known beforehand)+ -> BS.ByteString -- ^ The compressed payload+ -> BS.ByteString decompressBlocks uncompressedSize c = SB.fromShort $ SB.SBS a where (_, array) = decompressBlock' uncompressedSize c