You can leave out the conditional here as Ruby does the right thing with an empty $root:

irb(main):001:0> $root = ''
=> ""
irb(main):002:0> dir = '/foo/bar/baz/'
=> "/foo/bar/baz/"
irb(main):003:0> File.join($root, dir)
=> "/foo/bar/baz/"