Correctly replace root directory name during file discovery.