If to is a valid directory, from will be appended to to, adding and escaping backslashes as necessary. Otherwise, to will be returned. Useful for appending from to to only if the filename was not specified in to.
# File lib/ftools.rb, line 44 def catname(from, to) if directory? to join to.sub(%r([/\\]$), ''), basename(from) else to end end