mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-03 14:30:50 +03:00
feat(core): added discord rpc icons updating
This commit is contained in:
parent
1cd918c1cd
commit
b43b689955
1 changed files with 16 additions and 1 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Reference in a new issue