From: Jim Procter Date: Tue, 12 Nov 2024 12:51:14 +0000 (+0000) Subject: JAL-4077 patched sessionSave(File ) command and test for Jmol so it actually escapes... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e27f752dfc9e7978827ab85cf4b5565cd13bd219;p=jalview.git JAL-4077 patched sessionSave(File ) command and test for Jmol so it actually escapes backslashes --- diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index 7c024ba..7c9a4c4 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -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; } diff --git a/test/jalview/ext/jmol/JmolCommandsTest.java b/test/jalview/ext/jmol/JmolCommandsTest.java index 9684603..71fdaf1 100644 --- a/test/jalview/ext/jmol/JmolCommandsTest.java +++ b/test/jalview/ext/jmol/JmolCommandsTest.java @@ -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")