Adaptable paths for input and output files

Hi list, this might not be the most elegant method, however I'd call it the pragmatic way to refer to source *.osm.gz files in other directories by using template.args. It would be nice if you would consider the integration of such a functionality (output part follows, see mail above). Here's the unified diff: --- mkgmap-r1654/src/uk/me/parabola/mkgmap/Options.java Sun Aug 09 16:19:40 2009 +++ mkgmap/src/uk/me/parabola/mkgmap/Options.java Wed Jul 14 12:53:45 2010 @@ -84,6 +84,9 @@ BufferedReader br = new BufferedReader(r); TokenScanner ts = new TokenScanner(filename, br); ts.setExtraWordChars("-"); + + File file = new File(filename); + String parent = file.getParent(); while (!ts.isEndOfFile()) { Token tok = ts.nextToken(); @@ -110,6 +113,9 @@ } else { ts.skipLine(); continue; + } + if (val.endsWith(".osm.gz") && parent != null) { + val = parent + File.separator + val; } proc.processOption(new Option(key, val)); } else if (key != null){
participants (1)
-
Markus