Skip to content

Commit

Permalink
[win32] RP_ExtractImage: Fix an issue with directory thumbnailing for…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
GerbilSoft committed Nov 13, 2024
1 parent e264415 commit bf7429e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 8 additions & 2 deletions src/win32/RP_ExtractImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit bf7429e

Please sign in to comment.