JuicyPixels-blp 0.1.3.0 → 0.2.0.0
raw patch · 3 files changed
+17/−7 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- JuicyPixels-blp.cabal +1/−1
- blp2any/Convert.hs +11/−6
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.2.0.0+=======++Implement #1. Tool now preserves subfolder structure.+ 0.1.3.0 =======
JuicyPixels-blp.cabal view
@@ -1,5 +1,5 @@ name: JuicyPixels-blp-version: 0.1.3.0+version: 0.2.0.0 synopsis: BLP format decoder/encoder over JuicyPixels library description: The library provides decoding/encoding functions for BLP1 texture format of Warcraft III game.
blp2any/Convert.hs view
@@ -97,12 +97,14 @@ then convertFile opts False convertInput else do edx <- doesDirectoryExist convertInput- if edx then forEachFile' convertInput fileFilter $ convertFile opts True- else fail "Given path is not exists!"+ if edx then do + putStrLn $ "Converting all files from " ++ convertInput ++ " folder"+ forEachFile' convertInput fileFilter $ convertFile opts True+ else fail $ "Given path " ++ convertInput ++ " doesn't exsist!" where fileFilter s = case convertFormat of- Blp -> or $ ((takeExtension s) ==) <$> supportedExtensions- _ -> (".blp" ==) . takeExtension $ s+ Blp -> (fmap toLower $ takeExtension s) `elem` supportedExtensions+ _ -> (".blp" ==) . fmap toLower . takeExtension $ s -- | Trye to guess format from name of file guessFormat :: FilePath -> Maybe ConvertFormat@@ -144,11 +146,14 @@ when isDir $ createDirectoryIfMissing True convertOutput let outputFile = if isDir- then convertOutput <> "/" <> takeBaseName inputFile <> fromMaybe "" (listToMaybe $ formatExtension distFormat)+ then convertOutput + </> drop (length convertInput + 1) (takeDirectory inputFile)+ </> (takeBaseName inputFile <> fromMaybe "" (listToMaybe $ formatExtension distFormat)) else convertOutput+ createDirectoryIfMissing True $ takeDirectory outputFile let mipsCount = mipMapsUpTo convertBlpMinMipSize img- res <- (convertionFunction distFormat convertQuality convertBlpFormat) outputFile mipsCount img+ res <- convertionFunction distFormat convertQuality convertBlpFormat outputFile mipsCount img case res of Left err -> fail $ inputFile <> ": " <> err Right _ -> putStrLn $ inputFile <> ": Success"