cacheDir could be null here.