steve8x8 / geotoad

Geocaching query tool written in Ruby
https://buymeacoffee.com/steve8x8
Other
28 stars 8 forks source link

automatic output filename is broken #295

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start the text user interface, select the empty string as "filename" (23). 
It shows:
- - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - -
(22) output format  [gpx-gsak       ] | (23) filename   [automatic           ]
(24) output directory    [/home/chn/Desktop                                  ]
==============================================================================
2. Start the search with "s".
( o ) To use this query in the future, type:
( o ) geotoad --delimiter='|' --distanceMax=5km --format='gpx-gsak' 
--output='/home/chn/Desktop' [...]
3. At the end of the download session, this error occur:
( - ) Output format: GPX Geocaching XML for GSAK, without Additional Waypoints 
format
( - ) Output filename: /home/chn/Desktop
/usr/share/geotoad/lib/output.rb:435:in `initialize': Is a directory - 
/home/chn/Desktop (Errno::EISDIR)
        from /usr/share/geotoad/lib/output.rb:435:in `open'
        from /usr/share/geotoad/lib/output.rb:435:in `writeFile'
        from /usr/share/geotoad/lib/output.rb:479:in `commit'
        from /usr/bin/geotoad:984:in `block in saveFile'
        from /usr/bin/geotoad:957:in `each'
        from /usr/bin/geotoad:957:in `saveFile'
        from /usr/bin/geotoad:1051:in `<main>'

What is the expected output? What do you see instead?

I expect the filename to be something put together from the search parameters, 
just like previous versions of geotoad, for example "gt_Hudiksvall-y20km.gpx"

What version of the product are you using? On what operating system?

(===) GeoToad 3.19.1 (Ruby 1.9.3p194/2012-04-20 on i486-linux)
I'm using the Debian package.

Original issue reported on code.google.com by kalvd...@gmail.com on 31 Dec 2013 at 11:32

GoogleCodeExporter commented 9 years ago
Confirmed :( As a quick workaround, append a slash ('/') to the output path.

Original comment by Steve8x8 on 1 Jan 2014 at 10:36

GoogleCodeExporter commented 9 years ago
I can confirm that appending a slash works. Thanks for a quick reply!

Original comment by kalvd...@gmail.com on 1 Jan 2014 at 11:08

GoogleCodeExporter commented 9 years ago
Thank you. This gives me some time to give the whole code section a thorough 
review and overhaul: to be honest, I never liked the way filenames are 
constructed very much (though automatic filenames are a nice thing to have, 
with all the other options making the command-line hard to read (and keep 
complete).
Obviously, one of my recent code modifications broke this somewhat fragile 
thing (and while a small fix already exists on my local disk, I'd like to give 
it another two thoughts at least).
I will have to run some tests in a Windows environment (assuming that MacOSX 
and Linux are close enough to each other) how to identify directories, and if 
necessary create them.
Undoubtedly the TUI item is named "output directory" so it should in any case, 
training slash or not, be treated as such.
Stay tuned...

Original comment by Steve8x8 on 2 Jan 2014 at 7:41

GoogleCodeExporter commented 9 years ago
Patch set committed to SVN (as r1553).
This set of patches also tries to check for directory writability, and warns if 
something looks suspicious.
Please try to break it ;)

Original comment by Steve8x8 on 2 Jan 2014 at 12:27

GoogleCodeExporter commented 9 years ago
Even after r1553, it took a number of commits to iron out the worst oversights 
:(
Version 3.19.2 should be clean now.

Original comment by Steve8x8 on 6 Jan 2014 at 1:49