Fixes normalization of inmemory file paths

A normalized path always begins with "/" and never has a trailing slash
unless it is the root directory.