Sanity check on File.dirname

Hi,

I need a quick sanity check.

Excepting potential backslashes for the moment, aren’t these two
identical?

File.dirname(path).split(’/’)[0…-2].join(’/’)

File.dirname(File.dirname(path))

Dan

Dan, they differ if the path isn’t nested deeply enough, for example
“/a/b”, “/c” or “d”.

Regards,
Pit