module Java.JAR
(readManifest,
readJAR,
+ readMainClass,
addJAR
) where
where
good name = (str `isPrefixOf` name) && (".class" `isSuffixOf` name)
+-- | Read MainClass Entry of a MANIFEST.MF file
+readMainClass :: FilePath -> IO (Maybe String)
+readMainClass jarfile = do
+ Zip.withArchive [] jarfile $ do
+ m <- readManifest
+ case m of
+ Nothing -> return Nothing
+ Just mf -> return $ mainClass mf
+
-- | Read entries from JAR file, using MANIFEST.MF if it exists.
readJAR :: FilePath -> IO [Tree CPEntry]
readJAR jarfile = do