From: <gk...@us...> - 2009-12-21 19:24:15
|
Revision: 22445 http://gmod.svn.sourceforge.net/gmod/?rev=22445&view=rev Author: gk_fan Date: 2009-12-21 19:23:57 +0000 (Mon, 21 Dec 2009) Log Message: ----------- + If running in Web Start, will now extract "restriction_enzymes.dat" from the jar file Modified Paths: -------------- apollo/trunk/src/java/apollo/gui/tweeker/RestrictionEnzymeSelector.java Modified: apollo/trunk/src/java/apollo/gui/tweeker/RestrictionEnzymeSelector.java =================================================================== --- apollo/trunk/src/java/apollo/gui/tweeker/RestrictionEnzymeSelector.java 2009-12-21 18:35:28 UTC (rev 22444) +++ apollo/trunk/src/java/apollo/gui/tweeker/RestrictionEnzymeSelector.java 2009-12-21 19:23:57 UTC (rev 22445) @@ -31,6 +31,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import apollo.config.Config; import apollo.datamodel.SequenceI; import apollo.datamodel.Range; import apollo.datamodel.RangeI; @@ -181,8 +182,22 @@ /** Parse restriction enzyme file into vector */ private Vector getRestrictionEnzymes() { - String root = System.getProperty("APOLLO_ROOT"); - File resEnzFile = new File(root+"/data/restriction_enzymes.dat"); + //String root = System.getProperty("APOLLO_ROOT"); + //File resEnzFile = new File(root+"/data/restriction_enzymes.dat"); + String resEnzFileName = "restriction_enzymes.dat"; + String resEnzFileDir = "data"; + String resEnzPath = apollo.util.IOUtil.findFile(resEnzFileDir + "/" + resEnzFileName); + File resEnzFile = new File(Config.getRootDir() + "/" + resEnzFileDir + "/" + resEnzFileName); + if (resEnzPath == null || Config.isJavaWebStartApplication()) { + try { + Config.ensureExists(resEnzFile, resEnzFileName); + } + catch (Exception e) { + logger.warn("Couldn't find or create " + resEnzFileName); + return restrictionEnzymes; + } + } + try { // would be nice to file in relative way // this might just work for jar files? thought it would work for This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |