[win32] RP_ExtractImage: Fix an issue with directory thumbnailing for unsupported directories.

RP_ExtractImage::Load() needs to return E_FAIL, not S_OK, if the directory
is unsupported. Otherwise, Windows will show a regular directory icon,
without thumbnailing the directory's contents.

Fixes #427: No Thumbnails after install
Reported by @Conan179.
This commit is contained in:
David Korth 2024-11-12 22:21:43 -05:00
parent e264415bcc
commit bf7429ed29
2 changed files with 16 additions and 2 deletions

View File

@ -1,5 +1,13 @@
# Changes
## v2.4.1 (released 2024/11/12)
* Bug fixes:
* Windows: Fix an issue with directory thumbnailing that broke Windows'
built-in directory thumbnailer if the directory isn't supported.
* Fixes #427: No Thumbnails after install
* Reported by @Conan179.
## v2.4 (released 2024/11/10)
* New features:

View File

@ -121,16 +121,22 @@ IFACEMETHODIMP RP_ExtractImage::Load(_In_ LPCOLESTR pszFileName, DWORD dwMode)
}
// If ThumbnailDirectoryPackages is disabled, make sure this is *not* a directory.
const bool is_directory = FileSystem::is_directory(d->olefilename);
if (!config->getBoolConfigOption(Config::BoolConfig::Options_ThumbnailDirectoryPackages)) {
if (FileSystem::is_directory(d->olefilename)) {
if (is_directory) {
// It's a directory. Don't thumbnail it.
return S_OK;
return E_FAIL;
}
}
// Get the appropriate RomData class for this ROM.
// RomData class *must* support at least one image type.
d->romData = RomDataFactory::create(d->olefilename, RomDataFactory::RDA_HAS_THUMBNAIL);
if (!d->romData && is_directory) {
// Unable to thumbnail this RomData class, and it's a directory.
// Return E_FAIL in order to allow Explorer to thumbnail the directory normally.
return E_FAIL;
}
return S_OK;
}