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) {
|
match DiscordRpc::get_assets(CONFIG.launcher.discord_rpc.app_id) {
|
||||||
Ok(icons) => {
|
Ok(icons) => {
|
||||||
for icon in 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();
|
// 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() {
|
if !cache_file.exists() {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
Downloader::new(icon.get_uri())
|
Downloader::new(icon.get_uri())
|
||||||
|
|
Loading…
Reference in a new issue