8000 Merge pull request #188 from rubensa/patch-1 · angelozerr/typescript.java@1a84c7f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a84c7f

Browse files
authored
Merge pull request #188 from rubensa/patch-1
Support symbolink link
2 parents 95f09ee + 03db520 commit 1a84c7f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

core/ts.core/src/ts/utils/ZipUtils.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.io.OutputStream;
1818
import java.nio.file.Files;
1919
import java.nio.file.Path;
20+
import java.nio.file.Paths;
2021
import java.util.zip.GZIPInputStream;
2122
import java.util.zip.ZipEntry;
2223
import java.util.zip.ZipInputStream;
@@ -172,12 +173,22 @@ public static void extractTar(File file, File destination) throws IOException {
172173
break;
173174
case TarEntry.LINK:
174175
File linkFile = new File(destination, outFilename);
175-
Path target = new File(linkFile.getParentFile(), entry.getLinkName()).toPath();
176+
// Be sure that parent file exists
177+
File linkBaseDir = linkFile.getParentFile();
178+
if (!linkBaseDir.exists()) {
179+
linkBaseDir.mkdirs();
180+
}
181+
Path target = Paths.get(entry.getLinkName());
176182
Files.createLink(linkFile.toPath(), target);
177183
break;
178184
case TarEntry.SYM_LINK:
179185
File symLinkFile = new File(destination, outFilename);
180-
Path symTarget = new File(symLinkFile.getParentFile(), entry.getLinkName()).toPath();
186+
// Be sure that parent file exists
187+
File symLinkBaseDir = symLinkFile.getParentFile();
188+
if (!symLinkBaseDir.exists()) {
189+
symLinkBaseDir.mkdirs();
190+
}
191+
Path symTarget = Paths.get(entry.getLinkName());
181192
Files.createSymbolicLink(symLinkFile.toPath(), symTarget);
182193
break;
183194
}

0 commit comments

Comments
 (0)
0