mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Delete native library if it already exists (#179)
* Delete native library if it already exists * Spotless
This commit is contained in:
@@ -45,7 +45,10 @@ public class PicamJNI {
|
||||
URL resourceURL = PicamJNI.class.getResource("/nativelibraries/libpicam.so");
|
||||
File libFile = Path.of("lib/libpicam.so").toFile();
|
||||
try (InputStream in = resourceURL.openStream()) {
|
||||
if (libFile.exists()) Files.delete(libFile.toPath());
|
||||
Files.copy(in, libFile.toPath());
|
||||
} catch (Exception e) {
|
||||
logger.error("Could not extract the native library!");
|
||||
}
|
||||
System.load(libFile.getAbsolutePath());
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public class RequestHandler {
|
||||
|
||||
if (Platform.isRaspberryPi()) {
|
||||
try {
|
||||
new ShellExec().executeBashCommand("systemctl restart photonvision");
|
||||
new ShellExec().executeBashCommand("systemctl restart photonvision.service");
|
||||
} catch (IOException e) {
|
||||
logger.error("Could not restart device!", e);
|
||||
System.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user