JAL-4077 patched sessionSave(File ) command and test for Jmol so it actually escapes...
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 12 Nov 2024 12:51:14 +0000 (12:51 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Tue, 12 Nov 2024 12:51:14 +0000 (12:51 +0000)
src/jalview/ext/jmol/JmolCommands.java
test/jalview/ext/jmol/JmolCommandsTest.java

index 7c024ba..7c9a4c4 100644 (file)
@@ -242,7 +242,7 @@ public class JmolCommands extends StructureCommandsBase
      * https://chemapps.stolaf.edu/jmol/docs/#writemodel
      */
     StructureCommand sc = new StructureCommand(
-            "write STATE \"" + filepath + "\"");
+            "write STATE \"" + Platform.escapeBackslashes(filepath) + "\"");
     sc.setWaitNeeded(true);
     return sc;
   }
index 9684603..71fdaf1 100644 (file)
@@ -254,6 +254,8 @@ public class JmolCommandsTest
   {
     StructureCommandI cmd = testee.saveSession("/some/filepath");
     assertEquals(cmd.getCommand(), "write STATE \"/some/filepath\"");
+    cmd = testee.saveSession("\\some\\filepath");
+    assertEquals(cmd.getCommand(), "write STATE \"\\\\some\\\\filepath\"");
   }
 
   @Test(groups = "Functional")