Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Commit d3fbb29

Browse files
committed
Make tmpfile in same dir as boot.jar
Avoids issues where system temp directory is on another device or otherwise makes it impossible to do the atomic move.
1 parent ddd755c commit d3fbb29

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/boot/Loader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ public class Loader {
165165

166166
public static File
167167
download(String url, File f) throws Exception {
168-
File tmp = File.createTempFile("boot", ".jar");
168+
mkParents(f);
169+
170+
File tmp = File.createTempFile("boot", ".jar", f.getParentFile());
169171
int n = -1;
170172
byte[] buf = new byte[4096];
171173

@@ -175,7 +177,6 @@ public class Loader {
175177
while (-1 != (n = is.read(buf))) os.write(buf, 0, n); }
176178
System.err.println("done.");
177179

178-
mkParents(f);
179180
Files.move(tmp.toPath(), f.toPath(), REPLACE_EXISTING, ATOMIC_MOVE);
180181
return f; }
181182

0 commit comments

Comments
 (0)