MCPcopy Create free account
hub / github.com/Hello-hao/Tbed / generatePath

Method generatePath

src/main/java/cn/hellohao/utils/SetFiles.java:91–107  ·  view source on GitHub ↗
(String uploadFolder, Chunk chunk)

Source from the content-addressed store, hash-verified

89 }
90
91 public static String generatePath(String uploadFolder, Chunk chunk) {
92 StringBuilder sb = new StringBuilder();
93 sb.append(uploadFolder+File.separator).append("/").append(chunk.getIdentifier());
94 if (!Files.isWritable(Paths.get(sb.toString()))) {
95 System.err.println("path not exist,create path");
96 System.err.println(sb.toString());
97 try {
98 Files.createDirectories(Paths.get(sb.toString()));
99 } catch (IOException e) {
100 e.printStackTrace();
101 }
102 }
103 return sb.append("/")
104 .append(chunk.getFilename())
105 .append("-")
106 .append(chunk.getChunkNumber()).toString();
107 }
108
109 public static Msg merge(String targetFile, String folder, String filename) {
110 Msg msg = new Msg();

Callers 1

uploadChunkMethod · 0.95

Calls 2

createDirectoriesMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected