(JAL-1022) reverted to original strategy of escaping filenames in Jmol scripts becaus...
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Sun, 12 Feb 2012 16:00:03 +0000 (16:00 +0000)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Sun, 12 Feb 2012 16:00:03 +0000 (16:00 +0000)
src/jalview/gui/AppJmol.java
src/jalview/gui/Jalview2XML.java

index bd86275..93a2994 100644 (file)
@@ -35,6 +35,7 @@ import jalview.structure.*;
 import jalview.datamodel.PDBEntry;
 import jalview.io.*;
 import jalview.schemes.*;
+import jalview.util.Platform;
 
 public class AppJmol extends GStructureViewer implements Runnable,
         SequenceStructureBinding, ViewSetProvider
@@ -723,10 +724,10 @@ public class AppJmol extends GStructureViewer implements Runnable,
             // just transfer the file name from the first sequence's first
             // PDBEntry
             file = new File(((PDBEntry) pdbseq
-                    .getSequenceAt(0).getPDBId().elementAt(0)).getFile()).toURI().getPath().substring(1);
+                    .getSequenceAt(0).getPDBId().elementAt(0)).getFile()).getAbsolutePath();
             jmb.pdbentry[pi].setFile(file);
             
-            files.append(" \"" + file + "\"");
+            files.append(" \"" + Platform.escapeString(file) + "\"");
           }
           else
           {
@@ -749,7 +750,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
           }
           if (file != null)
           {
-            files.append(" \"" + file + "\"");
+            files.append(" \"" + Platform.escapeString(file) + "\"");
           }
         }
       }
index c8466b1..b1b1f55 100644 (file)
@@ -38,6 +38,7 @@ import jalview.datamodel.SequenceI;
 import jalview.schemabinding.version2.*;
 import jalview.schemes.*;
 import jalview.structure.StructureSelectionManager;
+import jalview.util.Platform;
 import jalview.util.jarInputStreamProvider;
 
 /**
@@ -1823,7 +1824,7 @@ public class Jalview2XML
         }
         ;
         out.close();
-        String t=outFile.toURI().getPath().substring(1);
+        String t=outFile.getAbsolutePath();
         alreadyLoadedPDB.put(pdbId, t);
         return t;
       }
@@ -2740,7 +2741,7 @@ public class Jalview2XML
               // have to normalize filename - since Jmol and jalview do filename
               // translation differently.
               Object[] filedat = oldFiles.get(new File(oldfilenam));
-              newFileLoc.append(((String) filedat[0]));
+              newFileLoc.append(Platform.escapeString((String) filedat[0]));
               pdbfilenames.addElement((String) filedat[0]);
               pdbids.addElement((String) filedat[1]);
               seqmaps.addElement((SequenceI[]) ((Vector<SequenceI>) filedat[2])