そんなん File.join 使えよ。そのためのものだろ。

base = "c:/windows/"
path = "./data/text.txt"
p File.join(base,path)

"c:/windows/./data/text.txt"

…あれ?