mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-23 01:21:40 +00:00
deleting service file before updating
This commit is contained in:
@@ -4,6 +4,7 @@ import edu.wpi.cscore.VideoMode;
|
||||
import org.opencv.core.Scalar;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
@@ -44,7 +45,11 @@ public class Helpers {
|
||||
|
||||
public static void setService(Path filePath) throws IOException, InterruptedException {
|
||||
String newService = String.format(kServiceString, filePath.toString());
|
||||
Writer writer = new FileWriter(kServicePath, false);
|
||||
File file = new File(kServicePath);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
Writer writer = new FileWriter(file, false);
|
||||
writer.write(newService);
|
||||
writer.close();
|
||||
Process p = Runtime.getRuntime().exec("systemctl enable chameleonVision.service");
|
||||
|
||||
Reference in New Issue
Block a user