rubycocos / markdown

markdown tools, libraries & scripts
Creative Commons Zero v1.0 Universal
52 stars 6 forks source link

File Exists error when specifying output path #6

Closed wimrijnders closed 9 years ago

wimrijnders commented 9 years ago

Hi there,

When I generate markdown with a specified output path:

markdown README.TXT -o /some/path/readme.erb

...and the target file exists, I get the following error:

/home/user/.rvm/rubies/ruby-2.1.5/lib64/ruby/2.1.0/fileutils.rb:250:in `mkdir': File exists @ dir_s_mkdir - /some/path/readme.erb (Errno::EEXIST)
    from /home/user/.rvm/rubies/ruby-2.1.5/lib64/ruby/2.1.0/fileutils.rb:250:in `fu_mkdir'
    from /home/user/.rvm/rubies/ruby-2.1.5/lib64/ruby/2.1.0/fileutils.rb:224:in `block (2 levels) in mkdir_p'
    ...<snip>...

I understand where this comes from, but I would prefer that the target file gets overwritten automatically.

Is it possible to adjust the default behavior so that the 'File exists' error does not occur? As an alternative, perhaps add a force-option to suppress the error, eg:

markdown README.TXT -f -o /some/path/readme.erb

Thanks,

Wim.

wimrijnders commented 9 years ago

I delved a bit further. If I leave out the filename in the output path, it works without error:

markdown README.TXT -o /some/path/

...but then I don't have the possibility of changing the output filename. By default, it will become 'README.html', what I intend is 'readme.erb'.

So, perhaps I should change the request in this issue. Could it be possible to explicitly rename the target file in the output path?

Thanks,

Wim.

geraldb commented 9 years ago

Thanks for reporting the issue. As far as I can remember the output is just the directory path. Please send the request / issue to the forum / mailing list for further discussion. Cheers.