mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Catch file exceptions in CameraConfig and ConfigManager
This commit is contained in:
@@ -4,6 +4,7 @@ import com.chameleonvision.util.JacksonHelper;
|
||||
import com.chameleonvision.vision.pipeline.CVPipelineSettings;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@@ -94,8 +95,13 @@ public class CameraConfig {
|
||||
|
||||
private void checkFolder() {
|
||||
if (!folderExists()) {
|
||||
if (!(new File(getFolderPath().toUri()).mkdirs())) {
|
||||
System.err.println("Failed to create camera config folder: " + getFolderPath().toString());
|
||||
try {
|
||||
if (!(new File(getFolderPath().toUri()).mkdirs())) {
|
||||
System.err.println("Failed to create camera config folder: " + getFolderPath().toString());
|
||||
}
|
||||
} catch(Exception e) {
|
||||
if(!(e instanceof java.nio.file.FileAlreadyExistsException || e instanceof java.nio.file.FileAlreadyExistsException))
|
||||
System.err.println("Failed to create camera config folder: " + getFolderPath().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ public class ConfigManager {
|
||||
new File(SettingsPath.toUri()).mkdirs();
|
||||
Files.createDirectory(SettingsPath);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if(!(e instanceof java.nio.file.FileAlreadyExistsException || e instanceof java.nio.file.FileAlreadyExistsException))
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user