From: Jim Procter Date: Sun, 12 Feb 2012 16:00:03 +0000 (+0000) Subject: (JAL-1022) reverted to original strategy of escaping filenames in Jmol scripts becaus... X-Git-Tag: Archived_Release_2_7~7 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0f368572e180ae64ad32158e80c46ca5a6acef96;p=jalview.git (JAL-1022) reverted to original strategy of escaping filenames in Jmol scripts because File.toURI().getPath().substring(1) stripped the leading '/' in OSX/Unixen. --- diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index bd86275..93a2994 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -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) + "\""); } } } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index c8466b1..b1b1f55 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -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) filedat[2])