/* Find a filename that is valid (not taken) with the given extension. */
CHAR16* EditGetDefaultFileName(IN CONST CHAR16 *Extension)
/* Find a filename that is valid (not taken) with the given extension. */
CHAR16* EditGetDefaultFileName(IN CONST CHAR16 *Extension)
{
  EFI_STATUS  Status;
  UINTN       Suffix;
  CHAR16      *FileNameTmp;
  Suffix = 0;
  do {
    FileNameTmp = CatSPrint (NULL, L"NewFile%d.%s", Suffix, Extension);
    Status = ShellFileExists (FileNameTmp);
    if (Status == EFI_NOT_FOUND) {
      return FileNameTmp;
    }
    FreePool (FileNameTmp);
    FileNameTmp = NULL;
    Suffix++;
  } while (Suffix != 0);
  FreePool (FileNameTmp);
  return NULL;
}