Profile

wshaffer: (Default)
wshaffer

September 2021

S M T W T F S
   123 4
56789 1011
12131415161718
19202122232425
2627282930  

Custom Text

Most Popular Tags

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:

require "pathname"
input_file = Pathname.new(ARGV[0])
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.

(no subject)

Date: 2014-10-04 09:48 pm (UTC)
From: [identity profile] wshaffer.livejournal.com
No, it doesn't. Although having googled it, I'm intrigued. Thanks for pointing out my (unintentional) reference!

(no subject)

Date: 2014-10-05 03:50 am (UTC)
From: [identity profile] onetarot.livejournal.com
I have such a long history with that series (and the company that made it) that I sometimes feel I was a part of its creation.

(Not at all true, although I was a part of its dissemination back when I had a radio show)

Explore and enjoy.

Expand Cut Tags

No cut tags

Style Credit