forked from ev3dev-lang-java/ev3dev-lang-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseElement.java
More file actions
32 lines (23 loc) · 960 Bytes
/
BaseElement.java
File metadata and controls
32 lines (23 loc) · 960 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
package fake_ev3dev;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@Slf4j
public abstract class BaseElement {
private static final String JAVA_IO_TEMPDIR = System.getProperty("java.io.tmpdir");
public static final String EV3DEV_FAKE_SYSTEM_PATH = JAVA_IO_TEMPDIR + "ev3dev_fake_system";
public static void createEV3DevFakeSystemPath() throws IOException {
final Path ev3devFakeSystemPath = Paths.get(EV3DEV_FAKE_SYSTEM_PATH);
if (!Files.exists(ev3devFakeSystemPath)) {
Files.createDirectories(ev3devFakeSystemPath);
LOGGER.trace("Path created: {}", ev3devFakeSystemPath);
}
}
public static void deleteEV3DevFakeSystemPath() throws IOException{
FileUtils.deleteDirectory(new File(EV3DEV_FAKE_SYSTEM_PATH));
}
}