Skip to content

Commit

Permalink
Replace hard link with move.
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Mar 20, 2024
1 parent 713e1ff commit 658ca0c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/net/fabricmc/loom/util/download/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,9 @@ private void downloadToPath(Path output, HttpResponse<InputStream> response) thr
}

try {
// Once the file has been fully read, create a hard link to the destination file.
// And then remove the temporary file, this ensures that the output file only exists in fully populated state.
Files.createLink(output, partFile);
Files.delete(partFile);
// Once the file has been fully read, move it to the destination file.
// This ensures that the output file only exists in fully populated state.
Files.move(partFile, output);
} catch (IOException e) {
throw error(e, "Failed to complete download");
}
Expand Down

0 comments on commit 658ca0c

Please sign in to comment.