2727import java .io .InputStreamReader ;
2828import java .io .InterruptedIOException ;
2929import java .io .StringWriter ;
30+ import java .net .URLDecoder ;
3031import java .net .UnknownHostException ;
3132import java .util .Optional ;
3233import java .util .logging .Level ;
4243public class DeployController {
4344 private final static String GRIP_JAR = "grip.jar" ;
4445 private final static String PROJECT_FILE = "project.grip" ;
46+ private final static String LOCAL_GRIP_JAR = URLDecoder .decode (
47+ Project .class .getProtectionDomain ().getCodeSource ().getLocation ().getPath ());
4548
4649 @ FXML private TextField address ;
4750 @ FXML private TextField user ;
@@ -149,8 +152,7 @@ public StreamCopier.Listener file(String name, long size) {
149152
150153 // Upload the GRIP core JAR and the serialized project to the robot
151154 scp .upload (new StringInMemoryFile (PROJECT_FILE , projectWriter .toString ()), deployDir + "/" );
152- scp .upload (new FileSystemFile (Project .class .getProtectionDomain ().getCodeSource ().getLocation ().getPath ()),
153- deployDir + "/" + GRIP_JAR );
155+ scp .upload (new FileSystemFile (LOCAL_GRIP_JAR ), deployDir + "/" + GRIP_JAR );
154156
155157 // Stop the pipeline before running it remotely, so the two instances of GRIP don't try to publish to the
156158 // same NetworkTables keys.
@@ -160,7 +162,8 @@ public StreamCopier.Listener file(String name, long size) {
160162 setStatusAsync ("Running GRIP" , false );
161163 Session session = ssh .startSession ();
162164 session .allocateDefaultPTY ();
163- Session .Command cmd = session .exec (javaHome + "/bin/java -jar " + deployDir + "/" + GRIP_JAR + " " + deployDir + "/" + PROJECT_FILE );
165+ Session .Command cmd = session .exec (javaHome + "/bin/java -jar " + deployDir + "/" + GRIP_JAR + "' '"
166+ + deployDir + "/" + PROJECT_FILE + "'" );
164167
165168 LineReader inputReader = new LineReader (new InputStreamReader (cmd .getInputStream ()));
166169 while (isNotCanceled ()) {
0 commit comments