private string CheckFileName(string fileName) { if (string.IsNullOrEmpty(fileName)) { fileName = RandomName(); } if (Path.IsPathRooted(fileName) || fileName.StartsWith("../", StringComparison.Ordinal)) { throw SpecFailure.TemporaryDirectoryFileNameRooted("fileName"); } return(Path.Combine(_basePath, fileName)); }