JAL-3921 escape and transform file paths for Jmol scripting environment
authorJim Procter <jprocter@dundee.ac.uk>
Wed, 13 Nov 2024 15:59:36 +0000 (15:59 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Wed, 13 Nov 2024 16:05:50 +0000 (16:05 +0000)
src/jalview/gui/AppJmol.java

index d37c9c0..6d57acd 100644 (file)
@@ -45,6 +45,7 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.StructureViewerModel;
 import jalview.datamodel.StructureViewerModel.StructureData;
+import jalview.ext.jmol.JmolCommands;
 import jalview.gui.ImageExporter.ImageWriterI;
 import jalview.gui.StructureViewer.ViewerType;
 import jalview.io.exceptions.ImageOutputException;
@@ -153,8 +154,7 @@ public class AppJmol extends StructureViewerBase
       }
     });
     StringBuilder cmd = new StringBuilder();
-    cmd.append("load FILES ").append(QUOTE)
-            .append(Platform.escapeBackslashes(sessionFile)).append(QUOTE);
+    cmd.append(jmb.getCommandGenerator().loadFile(sessionFile));
     initJmol(cmd.toString());
   }
 
@@ -301,7 +301,7 @@ public class AppJmol extends StructureViewerBase
     for (String s : files)
     {
       fileList.append(SPACE).append(QUOTE)
-              .append(Platform.escapeBackslashes(s)).append(QUOTE);
+              .append(JmolCommands.escapeQuotedFilename(s)).append(QUOTE);
     }
     String filesString = fileList.toString();