Mercurial > mxd2map
diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 174:707f13cfba74
Improved the commandline arguments and save the mapfile in the correct directory.
author | raimund.renkert@intevation.de |
---|---|
date | Wed, 06 Jul 2011 18:38:40 +0200 |
parents | 929e09649b08 |
children | f11d13940626 |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jul 06 18:27:46 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jul 06 18:38:40 2011 +0200 @@ -50,8 +50,22 @@ } public MapScriptWriter(String templ, String filename) { + String path = System.getProperty("user.dir"); map = new mapObj(templ); - mapFilename = filename; + File f = new File(filename); + mapFilename = filename; + if(f.isAbsolute()) { + map.setMappath(mapFilename); + } + else { + map.setMappath( + System.getProperty("user.dir") + + File.separator + + mapFilename); + mapFilename = System.getProperty("user.dir") + + File.separator + + mapFilename; + } } /** @@ -75,8 +89,9 @@ writeLayer(); //Save the map. mapObj cloneMap = map.cloneMap(); - cloneMap.save(mapFilename); - logger.info("Mapfile successfully created."); + + cloneMap.save(mapFilename); + logger.info("Mapfile created: " + mapFilename); return true; }