
Hi, a quick check in the source shows that it is not easy to implement. We have at least these parms to specify a path or file name or a list of them: --style-file --bounds --coastlinefile --input-file --output-dir --license-file --precomp-sea Each parm is handled in its own way, esp. the related checks for file existance etc. A possible solution would be a static utility method like static public File createFile(String path){ if (path.startsWith("~/")) ... return new File(...) } I am not convinced that it's worth all the work. Gerd Rich wrote
On 2013-02-14 23:48, Marko Mäkelä wrote:
Hi Gerd,
to be precise: I tested with ubuntu default shell.
java -jar mkgmap.jar ~/xyz.osm.pbf works java -jar mkgmap.jar --bounds=~/bounds_20121118.zip xyz.osm gives file not found error for the bounds file
That would probably be the Bourne again shell (bash), which is the default interactive shell in Debian. It will expand ~ at the start of an argument, but not in the middle.
man 1 bash says:
Tilde Expansion If a word begins with an unquoted tilde character (`~'), all of the characters preceding the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix.
Note the 'begins with'.
that's different. that part refers to tilde prefix being ~ <username> - for example, ~rich would be my home directory, but ~user would be user's home directory.
that's not bash specific - it is a unix-specific concept, and it is the current user's home directory. it would be really nice if it was also supported in scenarios like --bounds=~/user/bounds
hmm, turns out wikipedia page on tilde even has a section on "computing" :)
http://en.wikipedia.org/wiki/Tilde#Directories_and_URLs
IMO the simplest solution would be to accept this syntax if it is not accepted yet:
java -jar mkgmap.jar --bounds ~/bounds_20121118.zip xyz.osm
Then, the ~ would begin a word, and the shell would expand it.
A workaround is to write
java -jar mkgmap.jar --bounds="$HOME"/bounds_20121118.zip xyz.osm
(I usually use "" around variables in shell scripts, in case the variable value contains $IFS characters, such as spaces. I guess that defining HOME='/home/j. random user' could break some badly written scripts.)
Marko -- Rich
mkgmap-dev mailing list
mkgmap-dev@.org
-- View this message in context: http://gis.19327.n5.nabble.com/bounds-not-accepting-tilde-tp5749360p5749496.... Sent from the Mkgmap Development mailing list archive at Nabble.com.