import java.net.URL;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
+import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
fmuN = 0;
}
- File tempDir = new File(fmuDir);
- if(tempDir.isDirectory()) {
+ java.nio.file.Path tempDir = Paths.get(fmuDir);
+ if(Files.exists(tempDir) && Files.isDirectory(tempDir)) {
try {
- FileUtils.deleteAll(tempDir);
+ FileUtils.emptyDirectory(tempDir);
} catch (IOException e) {
- throw new FMILException("Could not create temp folder for fmu");
+ throw new FMILException("Could not delete existing files from temp folder for fmu " + path, e);
}
- tempDir.mkdir();
} else {
- tempDir.mkdir();
+ try {
+ Files.createDirectory(tempDir);
+ } catch (IOException e) {
+ throw new FMILException("Could not create temp folder for fmu " + path, e);
+ }
}
-
try {
- String tmpPath = tempDir.getAbsolutePath();
+ String tmpPath = tempDir.toString();
if(!tmpPath.endsWith("\\") && !tmpPath.endsWith("/"))
tmpPath = tmpPath + "/";
id = loadFMUFile_(path, tmpPath);