[fix] fix thumbnails deletion

This commit is contained in:
dijunkun
2025-07-01 11:13:24 +08:00
parent c47a90bf9c
commit ad60815d83
2 changed files with 2 additions and 5 deletions

View File

@@ -1285,13 +1285,9 @@ void Render::ProcessSdlEvent() {
if (stream_window_ && if (stream_window_ &&
SDL_GetWindowID(stream_window_) == event.window.windowID) { SDL_GetWindowID(stream_window_) == event.window.windowID) {
foucs_on_stream_window_ = focus_gained; foucs_on_stream_window_ = focus_gained;
LOG_INFO("{} focus on stream window",
focus_gained ? "Gained" : "Lost");
} else if (main_window_ && } else if (main_window_ &&
SDL_GetWindowID(main_window_) == event.window.windowID) { SDL_GetWindowID(main_window_) == event.window.windowID) {
foucs_on_main_window_ = focus_gained; foucs_on_main_window_ = focus_gained;
LOG_INFO("{} focus on main window",
focus_gained ? "Gained" : "Lost");
} }
} }
break; break;

View File

@@ -260,7 +260,8 @@ int Thumbnail::DeleteThumbnail(const std::string& filename_keyword) {
for (const auto& entry : std::filesystem::directory_iterator(image_path_)) { for (const auto& entry : std::filesystem::directory_iterator(image_path_)) {
if (entry.is_regular_file()) { if (entry.is_regular_file()) {
const std::string filename = entry.path().filename().string(); const std::string filename = entry.path().filename().string();
if (filename.find(filename_keyword) != std::string::npos) { std::string id_hostname = filename_keyword.substr(0, filename.find('@'));
if (filename.find(id_hostname) != std::string::npos) {
std::filesystem::remove(entry.path()); std::filesystem::remove(entry.path());
} }
} }