`dir + '/' + file` does not work, because when `dir` is `/` it results in `//test` for `file = 'test'`.