rootdir should be a local encoding.