From: <jom...@us...> - 2014-08-28 21:22:53
|
Revision: 1798 http://sourceforge.net/p/jason/svn/1798 Author: jomifred Date: 2014-08-28 21:22:45 +0000 (Thu, 28 Aug 2014) Log Message: ----------- improve API for Config class Modified Paths: -------------- trunk/src/jason/jeditplugin/Config.java Modified: trunk/src/jason/jeditplugin/Config.java =================================================================== --- trunk/src/jason/jeditplugin/Config.java 2014-08-25 21:21:16 UTC (rev 1797) +++ trunk/src/jason/jeditplugin/Config.java 2014-08-28 21:22:45 UTC (rev 1798) @@ -33,6 +33,7 @@ import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; @@ -608,7 +609,12 @@ if (bt.exists()) { in = new BufferedReader(new FileReader(bt)); } else { - in = new BufferedReader(new InputStreamReader(TransitionSystem.class.getResource("/templates/"+templateName).openStream())); + bt = new File(Config.get().getJasonHome()+"/src/templates/"+templateName); + if (bt.exists()) { + in = new BufferedReader(new FileReader(bt)); + } else { + in = new BufferedReader(new InputStreamReader(getDetaultResource(templateName))); + } } } @@ -626,6 +632,10 @@ } } + public InputStream getDetaultResource(String templateName) throws IOException { + return TransitionSystem.class.getResource("/templates/"+templateName).openStream(); + } + public static void main(String[] args) { Config.get().fix(); Config.get().store(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |