From 81c288725e7c67ca15ee690be917e588b684ae8c Mon Sep 17 00:00:00 2001 From: Xavier Fontanet Date: Sun, 19 May 2024 19:18:02 +0200 Subject: [PATCH] introduce hardlinker --- .../java/tv/mangrana/worker/FileCopier.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/tv/mangrana/worker/FileCopier.java diff --git a/src/main/java/tv/mangrana/worker/FileCopier.java b/src/main/java/tv/mangrana/worker/FileCopier.java new file mode 100644 index 0000000..6436901 --- /dev/null +++ b/src/main/java/tv/mangrana/worker/FileCopier.java @@ -0,0 +1,24 @@ +package tv.mangrana.worker; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +public class FileCopier { + + private void hardLink(Path source, Path destination) { + try { + Files.createLink(destination, source); + } catch (IOException e) { + System.out.printf("error when creating hardlink with destination %s, error: %s%n", + destination, e.getMessage()); + e.printStackTrace(); + } + } +} +class ProjectPath { + static Path of(String path) { + String projectPath = System.getProperty("user.dir"); + return Path.of(projectPath+path); + } +}