PCM: keep pinned state on update

This commit is contained in:
qu1ck 2023-01-23 09:28:49 -08:00 committed by Seth Hillbrand
parent e713a3eac2
commit d9e1763484
1 changed files with 9 additions and 2 deletions

View File

@ -778,8 +778,14 @@ void PLUGIN_CONTENT_MANAGER::DiscardRepositoryCache( const wxString& aRepository
void PLUGIN_CONTENT_MANAGER::MarkInstalled( const PCM_PACKAGE& aPackage, const wxString& aVersion,
const wxString& aRepositoryId )
{
// In case of package update remove old data
MarkUninstalled( aPackage );
// In case of package update remove old data but keep pinned state
bool pinned = false;
if( m_installed.count( aPackage.identifier ) )
{
pinned = m_installed.at( aPackage.identifier ).pinned;
MarkUninstalled( aPackage );
}
PCM_INSTALLATION_ENTRY entry;
entry.package = aPackage;
@ -799,6 +805,7 @@ void PLUGIN_CONTENT_MANAGER::MarkInstalled( const PCM_PACKAGE& aPackage, const w
}
entry.install_timestamp = getCurrentTimestamp();
entry.pinned = pinned;
m_installed.emplace( aPackage.identifier, entry );
}