D
Daniel Berger
Hi all,
Occasionally I have to do something like this:
bitbucket = RUBY_PLATFORM.match('mswin') ? 'NUL' : '/dev/null'
How about a Dir.bitbucket method? Or Dir.null, or whatever you want to
call it.
I think the code, using pure Ruby, would look like this:
case RUBY_PLATFORM
when /mswin/i
'NUL'
when /amiga/i
'NIL:'
when /openvms/i
'NL:'
else
'/dev/null'
end
I based this on http://en.wikipedia.org/wiki//dev/null
Useful? If so, we could easily patch dir.c, though I'm not sure what
the best way to approach it would be, i.e. should we do platform checks
within the code or rely on constants set during the build phase?
Regards,
Dan
Occasionally I have to do something like this:
bitbucket = RUBY_PLATFORM.match('mswin') ? 'NUL' : '/dev/null'
How about a Dir.bitbucket method? Or Dir.null, or whatever you want to
call it.
I think the code, using pure Ruby, would look like this:
case RUBY_PLATFORM
when /mswin/i
'NUL'
when /amiga/i
'NIL:'
when /openvms/i
'NL:'
else
'/dev/null'
end
I based this on http://en.wikipedia.org/wiki//dev/null
Useful? If so, we could easily patch dir.c, though I'm not sure what
the best way to approach it would be, i.e. should we do platform checks
within the code or rely on constants set during the build phase?
Regards,
Dan