Skip to content

Commit

Permalink
Prevent caching DisplayMenu filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Chadnaut committed Dec 20, 2024
1 parent e68df54 commit 13bd5e6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/fe_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const char *FE_CACHE_SUBDIR = "cache/";
const char *FE_CACHE_ROMLIST = ".romlist";
const char *FE_CACHE_FILTERS = ".filters";
const std::string FE_EMPTY_STRING;

//
// Returns cache base dir
Expand All @@ -34,8 +35,10 @@ std::string get_display_cache_filename(
FeDisplayInfo &display
)
{
std::string name = display.get_name();
if ( name.empty() ) return FE_EMPTY_STRING;
return get_cache_dir( config_path )
+ sanitize_filename( display.get_name() )
+ sanitize_filename( name )
+ FE_CACHE_ROMLIST
+ FE_CACHE_EXT;
}
Expand All @@ -48,8 +51,10 @@ std::string get_filters_cache_filename(
FeDisplayInfo &display
)
{
std::string name = display.get_name();
if ( name.empty() ) return FE_EMPTY_STRING;
return get_cache_dir( config_path )
+ sanitize_filename( display.get_name() )
+ sanitize_filename( name )
+ FE_CACHE_FILTERS
+ FE_CACHE_EXT;
}
Expand Down Expand Up @@ -167,6 +172,7 @@ bool FeCache::save_display_cache(
)
{
std::string filename = get_display_cache_filename( config_path, display );
if ( filename.empty() ) return false;
confirm_directory( config_path, FE_CACHE_SUBDIR );
nowide::ofstream file( filename, std::ios::binary );
if ( !file.is_open() ) return false;
Expand Down Expand Up @@ -247,6 +253,7 @@ bool FeCache::save_filters_cache(
)
{
std::string filename = get_filters_cache_filename( config_path, display );
if ( filename.empty() ) return false;
confirm_directory( config_path, FE_CACHE_SUBDIR );
nowide::ofstream file( filename, std::ios::binary );
if ( !file.is_open() ) return false;
Expand Down

0 comments on commit 13bd5e6

Please sign in to comment.