1
0
Fork 0

introduce hardlinker

This commit is contained in:
Xavier Fontanet 2024-05-19 19:18:02 +02:00
parent cc110c6487
commit 81c288725e
1 changed files with 24 additions and 0 deletions

View File

@ -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);
}
}