Repository: xbmc/xbmc
File: xbmc/utils/URIUtils.cpp (C++)

Code before:
    return IsNfs(CSpecialProtocol::TranslatePath(strFile));

  CURL url(strFile);
  if (HasParentInHostname(url))
    return IsNfs(url.GetHostName());

  return IsProtocol(strFile, "nfs");
}

bool URIUtils::IsVideoDb(const std::string& strFile)
{
  return IsProtocol(strFile, "videodb");
}

bool URIUtils::IsBlurayPath(const std::string& strFile)
{
  return IsProtocol(strFile, "bluray");
}

bool URIUtils::IsBDFile(const std::string& file)
{
  const std::vector<std::string> files = {"index.bdmv", "INDEX.BDM", "MovieObject.bdmv",
                                          "MOVIEOBJ.BDM"};
  const std::string filename{GetFileName(file)};
  return std::ranges::any_of(files, [filename](const std::string& f)
                             { return StringUtils::EqualsNoCase(f, filename); });
}

bool URIUtils::IsAndroidApp(const std::string &path)
{
  return IsProtocol(path, "androidapp");
}

bool URIUtils::IsLibraryFolder(const std::string& strFile)
{
  CURL url(strFile);
  return url.IsProtocol("library");
}

bool URIUtils::IsLibraryContent(const std::string &strFile)
{
  return (IsProtocol(strFile, "library") ||
          IsProtocol(strFile, "videodb") ||
          IsProtocol(strFile, "musicdb") ||
          StringUtils::EndsWith(strFile, ".xsp"));
}

bool URIUtils::IsDOSPath(const std::string &path)
{
  if (path.size() > 1 && path[1] == ':' && isalpha(path[0]))
    return true;

Review comment (suggestion):
No need to construct this vector with every call to this method. Either make it `static`, even better as it has only fixed members, make it even more simple. Less fancy, but performant.

```c++
const std::string filename{GetFileName(file)};
return (StringUtils::EqualsNoCase(filename, "index.bdmv") || StringUtils::EqualsNoCase(filename, "INDEX.BDM") || ...);

```

Code after:
{
  return StringUtils::StartsWith(strFile, "pvr://recordings/tv");
}

bool URIUtils::IsPVRRadioRecordingFileOrFolder(const std::string& strFile)
{
  return StringUtils::StartsWith(strFile, "pvr://recordings/radio");
}

bool URIUtils::IsMusicDb(const std::string& strFile)
{
  return IsProtocol(strFile, "musicdb");
}

bool URIUtils::IsNfs(const std::string& strFile)
{
  if (IsStack(strFile))
    return IsNfs(CStackDirectory::GetFirstStackedFile(strFile));

  if (IsSpecial(strFile))
    return IsNfs(CSpecialProtocol::TranslatePath(strFile));

  CURL url(strFile);
  if (HasParentInHostname(url))
    return IsNfs(url.GetHostName());

  return IsProtocol(strFile, "nfs");
}

bool URIUtils::IsVideoDb(const std::string& strFile)
{
  return IsProtocol(strFile, "videodb");
}

bool URIUtils::IsBlurayPath(const std::string& strFile)
{
  return IsProtocol(strFile, "bluray");
}

bool URIUtils::IsOpticalMediaFile(const std::string& file)
{
  return IsBDFile(file) || IsDVDFile(file);
}

bool URIUtils::IsBDFile(const std::string& file)
{
  const std::string fileName{GetFileName(file)};
  return StringUtils::EqualsNoCase(fileName, "index.bdmv") ||
         StringUtils::EqualsNoCase(fileName, "MovieObject.bdmv") ||
         StringUtils::EqualsNoCase(fileName, "INDEX.BDM") ||
         StringUtils::EqualsNoCase(fileName, "MOVIEOBJ.BDM");