modified to normalize a root path.