Repository: xbmc/xbmc
File: xbmc/filesystem/FileDirectoryFactory.cpp (C++)

Code before:

  // Get file extensions to find addon related to it.
  std::string strExtension = URIUtils::GetExtension(url);
  StringUtils::ToLower(strExtension);

  if (!strExtension.empty() && CServiceBroker::IsAddonInterfaceUp())
  {
    /*!
     * Scan here about audiodecoder addons.
     *
     * @note: Do not check audio decoder files that are already open, they cannot
     * contain any further sub-folders.
     */
    if (!StringUtils::EndsWith(strExtension, KODI_ADDON_AUDIODECODER_TRACK_EXT))
    {
      auto addonInfos = CServiceBroker::GetExtsMimeSupportList().GetExtensionSupportedAddonInfos(
          strExtension, CExtsMimeSupportList::FilterSelect::hasTracks);
      for (const auto& addonInfo : addonInfos)
      {
        std::unique_ptr<CAudioDecoder> result = std::make_unique<CAudioDecoder>(addonInfo.second);
        if (!result->CreateDecoder() || !result->ContainsFiles(url))
        {
          CLog::LogF(LOGINFO,
                     "Addon '{}' support extension '{}' but creation failed (seems not supported), "
                     "trying other addons and Kodi",
                     addonInfo.second->ID(), strExtension);
          continue;
        }
        return result.release();
      }
    }

    /*!
     * Scan here about VFS addons.
     */
    for (const auto& vfsAddon : CServiceBroker::GetVFSAddonCache().GetAddonInstances())
    {
      if (vfsAddon->HasFileDirectories())
      {
        auto exts = StringUtils::Split(vfsAddon->GetExtensions(), "|");
        if (std::find(exts.begin(), exts.end(), strExtension) != exts.end())
        {
          CVFSEntryIFileDirectoryWrapper* wrap = new CVFSEntryIFileDirectoryWrapper(vfsAddon);
          if (wrap->ContainsFiles(url))
          {
            if (wrap->GetItems().Size() == 1)
            {
              // one STORED file - collapse it down
              *pItem = *wrap->GetItems()[0];
            }
            else

Review comment (bug):
At other places, for LOGINFO you removed the logging of the method signature, which I consider a good decision. INFO is normal operation not requiring this level of details. However, here you keep the log of method signature. I suggest to remove it, for consistency reasons.

Or is this log rather a DEBUG (I think so) or a WARNING or even an ERROR? In that case, the log type should be changed and method signature log should be kept.

Code after:

  // Get file extensions to find addon related to it.
  std::string strExtension = URIUtils::GetExtension(url);
  StringUtils::ToLower(strExtension);

  if (!strExtension.empty() && CServiceBroker::IsAddonInterfaceUp())
  {
    /*!
     * Scan here about audiodecoder addons.
     *
     * @note: Do not check audio decoder files that are already open, they cannot
     * contain any further sub-folders.
     */
    if (!StringUtils::EndsWith(strExtension, KODI_ADDON_AUDIODECODER_TRACK_EXT))
    {
      auto addonInfos = CServiceBroker::GetExtsMimeSupportList().GetExtensionSupportedAddonInfos(
          strExtension, CExtsMimeSupportList::FilterSelect::hasTracks);
      for (const auto& addonInfo : addonInfos)
      {
        std::unique_ptr<CAudioDecoder> result = std::make_unique<CAudioDecoder>(addonInfo.second);
        if (!result->CreateDecoder() || !result->ContainsFiles(url))
        {
          CLog::LogF(LOGWARNING,
                     "Addon '{}' support extension '{}' but creation failed (seems not supported), "
                     "trying other addons and Kodi",
                     addonInfo.second->ID(), strExtension);
          continue;
        }
        return result.release();
      }
    }

    /*!
     * Scan here about VFS addons.
     */
    for (const auto& vfsAddon : CServiceBroker::GetVFSAddonCache().GetAddonInstances())
    {
      if (vfsAddon->HasFileDirectories())
      {
        auto exts = StringUtils::Split(vfsAddon->GetExtensions(), "|");
        if (std::find(exts.begin(), exts.end(), strExtension) != exts.end())
        {
          CVFSEntryIFileDirectoryWrapper* wrap = new CVFSEntryIFileDirectoryWrapper(vfsAddon);
          if (wrap->ContainsFiles(url))
          {
            if (wrap->GetItems().Size() == 1)
            {
              // one STORED file - collapse it down
              *pItem = *wrap->GetItems()[0];
            }
            else