After a bit of research, I found a much better way to do the file name manipulation I was talking about in my previous post
Basically, it boils down to:
input_file = Pathname.new(ARGV)
new_base = (input_file.basename(input_file.extname)).to_s + "_counts" + input_file.extname.to_s
output_file = input_file.dirname + Pathname.new(new_base)
I used Pathname instead of File because the documentation suggests that it's more robust at dealing with different file pathing conventions on different OSes.
I'm a little dubious about the dance I had to do there of converting path fragments to strings, concatenating them, and then converting back to a pathname, but trying to concatenate the path fragments directly kept giving me extra / in the path.