self-extract 0.3.2 → 0.3.3
raw patch · 3 files changed
+21/−7 lines, 3 filesdep ~ztar
Dependency ranges changed: ztar
Files
- CHANGELOG.md +6/−0
- self-extract.cabal +2/−2
- src/Codec/SelfExtract.hs +13/−5
CHANGELOG.md view
@@ -1,3 +1,9 @@+## self-extract 0.3.3++Fixes:+* Make bundling occur in same directory as exe+* Use typed paths for `ztar`+ ## self-extract 0.3.2 Fixes:
self-extract.cabal view
@@ -1,5 +1,5 @@ name: self-extract-version: 0.3.2+version: 0.3.3 license: BSD3 license-file: LICENSE.md author: Brandon Chinn <brandonchinn178@gmail.com>@@ -34,7 +34,7 @@ , path >= 0.6 && < 0.7 , path-io >= 1.3 && < 1.4 , unix-compat >= 0.5 && < 0.6- , ztar >= 0.1.1 && < 0.2+ , ztar >= 0.2 && < 0.3 ghc-options: -Wall if flag(dev) ghc-options: -Werror
src/Codec/SelfExtract.hs view
@@ -20,7 +20,7 @@ , bundle' ) where -import Codec.Archive.ZTar (Compression(..), create, extract)+import Codec.Archive.ZTar (Compression(..), create', extract') import Control.Monad ((>=>)) import Control.Monad.Extra (unlessM) import Data.Binary (Word32, decode, encode)@@ -34,13 +34,21 @@ , Path , fromAbsDir , fromAbsFile+ , parent , parseAbsFile , relfile , toFilePath , (</>) ) import Path.IO- (doesFileExist, renameFile, resolveDir', resolveFile', withSystemTempDir, withSystemTempFile)+ ( doesFileExist+ , renameFile+ , resolveDir'+ , resolveFile'+ , withSystemTempDir+ , withSystemTempFile+ , withTempDir+ ) import System.Environment (getExecutablePath) import System.IO (IOMode(..), SeekMode(..), hClose, hSeek, withFile) import qualified System.PosixCompat.Files as Posix@@ -90,7 +98,7 @@ BS.hGetContents hSelf >>= BS.hPut hTemp hClose hTemp- extract (toFilePath dir) $ fromAbsFile archive+ extract' archive dir -- | Same as 'withExtractToTemp', except using the 'Path' library. withExtractToTemp' :: (Path Abs Dir -> IO ()) -> IO ()@@ -107,7 +115,7 @@ size <- getFileSize exe - withSystemTempDir "self-extract" $ \tempDir -> do+ withTempDir (parent exe) "self-extract" $ \tempDir -> do let exeWithSize = tempDir </> [relfile|exe_with_size|] injectFileWith "self-extract" (LBS.toStrict $ encode size)@@ -115,7 +123,7 @@ (fromAbsFile exeWithSize) let archive = tempDir </> [relfile|bundle.tar.gz|]- create GZip (fromAbsFile archive) $ toFilePath dir+ create' GZip archive dir let combined = tempDir </> [relfile|exe_and_bundle|] cat [exeWithSize, archive] combined