In general we aren't building long paths. However, why not make `stack` a `String`:

```ruby
stack = ""
if stack.empty? && part == ""
  stack = File::SEPARATOR   # This may have issues on Windows??
else
  stack = File.join(stack, part)
end
```

Then there's no need to keep re-joining the path parts.