feat(core): added discord rpc icons updating

This commit is contained in:
Observer KRypt0n_ 2023-06-18 10:49:29 +02:00
parent 1cd918c1cd
commit b43b689955
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2

View file

@ -670,9 +670,24 @@ impl SimpleAsyncComponent for EnhancementsApp {
match DiscordRpc::get_assets(CONFIG.launcher.discord_rpc.app_id) {
Ok(icons) => {
for icon in icons {
let cache_file = CACHE_FOLDER.join("discord-rpc").join(&icon.name);
let cache_file = CACHE_FOLDER
.join("discord-rpc")
.join(&icon.name)
.join(&icon.id);
// let sender = sender.clone();
// Workaround for old folder structure (pre 3.7.3)
let old_path = CACHE_FOLDER.join("discord-rpc").join(&icon.name);
if old_path.exists() {
if let Ok(metadata) = old_path.metadata() {
if metadata.is_file() {
std::fs::remove_file(old_path).expect("Failed to delete old discord rpc icon");
}
}
}
if !cache_file.exists() {
std::thread::spawn(move || {
Downloader::new(icon.get_uri())