-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPath2DIR.java
More file actions
35 lines (26 loc) · 803 Bytes
/
Path2DIR.java
File metadata and controls
35 lines (26 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package de.bolben.utils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
/**
* @Author Benjamin Bolgrin
*
* This class takes 2 Path objects (rootDir and subDir) and creates the directories, if they don't exist on the hard disk.
*/
public class Path2DIR {
private final Path rootDir;
private final Path subDir;
public Path2DIR(Path rootDir, Path subDir){
this.rootDir = rootDir;
this.subDir = subDir;
}
private Path combinedPath(){
String baseDir = rootDir.toString();
String subDir2 = subDir.toString();
return Path.of(baseDir + subDir2);
}
public void mkdirs() throws IOException {
Path combinedPath = this.combinedPath();
Files.createDirectories(combinedPath);
}
}