4747import java .util .Set ;
4848import java .util .regex .Pattern ;
4949import java .util .stream .Collectors ;
50- import java .util .zip .ZipEntry ;
51- import java .util .zip .ZipFile ;
50+
51+ import org .apache .commons .compress .archivers .zip .ZipArchiveEntry ;
52+ import org .apache .commons .compress .archivers .zip .ZipFile ;
5253
5354import org .apache .commons .cli .CommandLine ;
5455import org .apache .commons .cli .CommandLineParser ;
@@ -1260,10 +1261,10 @@ private void unpackANE(File aneFile) throws ASConfigCException {
12601261 }
12611262
12621263 try {
1263- ZipFile zipFile = new ZipFile ( aneFile );
1264- Enumeration <?> zipEntries = zipFile .entries ();
1264+ ZipFile zipFile = ZipFile . builder (). setFile ( aneFile ). get ( );
1265+ Enumeration <?> zipEntries = zipFile .getEntries ();
12651266 while (zipEntries .hasMoreElements ()) {
1266- ZipEntry zipEntry = (ZipEntry ) zipEntries .nextElement ();
1267+ ZipArchiveEntry zipEntry = (ZipArchiveEntry ) zipEntries .nextElement ();
12671268 if (zipEntry .isDirectory ()) {
12681269 continue ;
12691270 }
@@ -1272,6 +1273,18 @@ private void unpackANE(File aneFile) throws ASConfigCException {
12721273 File destParent = new File (destFile .getParent ());
12731274 destParent .mkdirs ();
12741275
1276+ if (zipEntry .isUnixSymlink ()) {
1277+ Path link = destFile .toPath ();
1278+ Path target = Paths .get (zipFile .getUnixSymlink (zipEntry ));
1279+ try {
1280+ Files .createSymbolicLink (link , target );
1281+ continue ;
1282+ } catch (Exception e ) {
1283+ System .out .println ("Failed to create symbolic link: " + currentAneDirectory .toPath ().relativize (link )
1284+ + " -> " + target + ", will write as regular file instead." );
1285+ }
1286+ }
1287+
12751288 BufferedInputStream inStream = new BufferedInputStream (zipFile .getInputStream (zipEntry ));
12761289 FileOutputStream fileOutStream = new FileOutputStream (destFile );
12771290 byte buffer [] = new byte [2048 ];
0 commit comments