diff --git a/CHANGELOG.md b/CHANGELOG.md index 635a679..b2809b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added deletion of old patch files (just in case) +- Added telemetry disabling state support +- Added Discord RPC icons updating + +### Changed + +- Replaced xlua patch by "disable mhypbase" option +- Returned back old `background` file path ## [1.2.1] - 15.06.2023 diff --git a/Cargo.lock b/Cargo.lock index 9b8ee4e..de298de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher", @@ -48,8 +48,8 @@ dependencies = [ [[package]] name = "anime-game-core" -version = "1.12.6" -source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.12.6#704c7fb4741fa1c90596d5862f963653cd0ddbbd" +version = "1.13.1" +source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.13.1#e8b99564f4ea12a331aa276ea91fe65c0ead465e" dependencies = [ "anyhow", "bzip2", @@ -73,8 +73,8 @@ dependencies = [ [[package]] name = "anime-launcher-sdk" -version = "1.7.7" -source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.7.7#e43606d12e261301a5dc84e21fb47a53cff46fc2" +version = "1.8.2" +source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.8.2#1a9323152099ec958538e32cb5a3c423271b00c8" dependencies = [ "anime-game-core", "anyhow", @@ -520,9 +520,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -2437,9 +2437,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" dependencies = [ "itoa", "ryu", @@ -2479,9 +2479,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", diff --git a/Cargo.toml b/Cargo.toml index 3a1aaa5..5aa1167 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ glib-build-tools = "0.17" [dependencies.anime-launcher-sdk] git = "https://github.com/an-anime-team/anime-launcher-sdk" -tag = "1.7.7" +tag = "1.8.2" features = ["all", "star-rail", "star-rail-patch"] # path = "../anime-launcher-sdk" # ! for dev purposes only diff --git a/assets/locales/de/errors.ftl b/assets/locales/de/errors.ftl index 59fa4ba..23d9e31 100644 --- a/assets/locales/de/errors.ftl +++ b/assets/locales/de/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Spiel konnte nicht gepatcht werden main-patch-update-failed = Die neuste Version des Patches konnte nicht heruntergeladen werden +# Disable telemetry + +telemetry-servers-disabling-error = Telemetrie server konnten nicht geblockt werden + # Sandbox documentation-url-open-failed = Dokumentations-URL kann nicht geöffnet werden diff --git a/assets/locales/de/main.ftl b/assets/locales/de/main.ftl index 2343730..b85a0e7 100644 --- a/assets/locales/de/main.ftl +++ b/assets/locales/de/main.ftl @@ -54,6 +54,8 @@ components-index-updated = Kompontentenverzeichnis wurde aktualisiert launch = Starten migrate-folders = Ordner migrieren migrate-folders-tooltip = Spielordnerstruktur aktualisieren +apply-patch = Patch anwenden +disable-telemetry = Blockiere Telemetrie download-wine = Wine Herunterladen create-prefix = Prefix erstellen update = Updaten diff --git a/assets/locales/en/errors.ftl b/assets/locales/en/errors.ftl index 35d3f3d..582f916 100644 --- a/assets/locales/en/errors.ftl +++ b/assets/locales/en/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Failed to patch game main-patch-update-failed = Failed to download latest patch version +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Failed to open documentation URL diff --git a/assets/locales/en/main.ftl b/assets/locales/en/main.ftl index ef3ba34..6a3189d 100644 --- a/assets/locales/en/main.ftl +++ b/assets/locales/en/main.ftl @@ -54,6 +54,8 @@ components-index-updated = Components index was updated launch = Launch migrate-folders = Migrate folders migrate-folders-tooltip = Update game folders structure +apply-patch = Apply patch +disable-telemetry = Disable telemetry download-wine = Download wine create-prefix = Create prefix update = Update diff --git a/assets/locales/es/errors.ftl b/assets/locales/es/errors.ftl index 365fc9d..ecdd7f0 100644 --- a/assets/locales/es/errors.ftl +++ b/assets/locales/es/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Fallo al parchear el juego main-patch-update-failed = Fallo al descargar la última versión del parche +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Failed to open documentation URL diff --git a/assets/locales/es/main.ftl b/assets/locales/es/main.ftl index 1c85662..70a1adf 100644 --- a/assets/locales/es/main.ftl +++ b/assets/locales/es/main.ftl @@ -54,6 +54,8 @@ components-index-updated = Se actualizó el índice de componentes launch = Iniciar migrate-folders = Migrar carpetas migrate-folders-tooltip = Actualizar estructura de carpetas del juego +apply-patch = Aplicar parche +disable-telemetry = Disable telemetry download-wine = Descargar wine create-prefix = Crear prefijo update = Actualizar diff --git a/assets/locales/fr/errors.ftl b/assets/locales/fr/errors.ftl index ccbb98c..524de3f 100644 --- a/assets/locales/fr/errors.ftl +++ b/assets/locales/fr/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Le patch du jeu a échoué main-patch-update-failed = Impossible de télécharger la dernière version du patch +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Failed to open documentation URL diff --git a/assets/locales/fr/general.ftl b/assets/locales/fr/general.ftl index 896d445..74cac93 100644 --- a/assets/locales/fr/general.ftl +++ b/assets/locales/fr/general.ftl @@ -48,11 +48,11 @@ patch-preparation-tooltip = Le patch est en développement patch-testing-tooltip = Patch de test disponible patch-not-applied-tooltip = Patch is not applied +patch-broken-tooltip = La version actuelle du patch ne fonctionne pas correctement +patch-unsafe-tooltip = La version actuelle du patch n'est pas safe, et ne doit pas être utilisée apply-main-patch = Appliquer le patch principal apply-main-patch-description = Expériment. Désactiver cette option permet de lancer le jeu sans le patch. Il n'est pas garanti que cette option marche, et des modifications manuelles seront potentiellement nécessaires. À n'utiliser que si vous savez ce que vous faites -patch-broken-tooltip = La version actuelle du patch ne fonctionne pas correctement -patch-unsafe-tooltip = La version actuelle du patch n'est pas safe, et ne doit pas être utilisée ask-superuser-permissions = Ask superuser permissions ask-superuser-permissions-description = Launcher will use them to automatically update your hosts file. This is not needed in flatpak edition diff --git a/assets/locales/fr/main.ftl b/assets/locales/fr/main.ftl index fdd6045..75e3644 100644 --- a/assets/locales/fr/main.ftl +++ b/assets/locales/fr/main.ftl @@ -54,6 +54,8 @@ components-index-updated = L'index des composants a été mis à jour launch = Lancer migrate-folders = Migrate folders migrate-folders-tooltip = Update game folders structure +apply-patch = Appliquer le patch +disable-telemetry = Disable telemetry download-wine = Télécharger wine create-prefix = Créer le préfix wine update = Mettre à jour diff --git a/assets/locales/hu/errors.ftl b/assets/locales/hu/errors.ftl index 519c1fa..8918a77 100644 --- a/assets/locales/hu/errors.ftl +++ b/assets/locales/hu/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Sikertelen játék patchelés main-patch-update-failed = Failed to download latest patch version +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Failed to open documentation URL diff --git a/assets/locales/hu/main.ftl b/assets/locales/hu/main.ftl index b49ef14..8b0b01c 100644 --- a/assets/locales/hu/main.ftl +++ b/assets/locales/hu/main.ftl @@ -54,6 +54,8 @@ components-index-updated = A komponens index frissítve lett launch = Indítás migrate-folders = Mappák migrálása migrate-folders-tooltip = Játékmappa struktúra frissítése +apply-patch = Patch alkalmazása +disable-telemetry = Disable telemetry download-wine = Wine letöltése create-prefix = Prefix létrehozása update = Frissítés diff --git a/assets/locales/id/errors.ftl b/assets/locales/id/errors.ftl index 75b269e..3a51e71 100644 --- a/assets/locales/id/errors.ftl +++ b/assets/locales/id/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Gagal melakukan patch pada game main-patch-update-failed = Gagal mengunduh patch versi terbaru +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Gagal membuka tautan dokumentasi diff --git a/assets/locales/id/main.ftl b/assets/locales/id/main.ftl index 51fae95..afb9e7a 100644 --- a/assets/locales/id/main.ftl +++ b/assets/locales/id/main.ftl @@ -54,6 +54,8 @@ components-index-updated = Index komponen baru saja diperbarui launch = Luncurkan migrate-folders = Pindahkan folder migrate-folders-tooltip = Perbarui struktur folder game +apply-patch = Terapkan patch +disable-telemetry = Disable telemetry download-wine = Unduh wine create-prefix = Buat prefix update = Perbarui diff --git a/assets/locales/it/errors.ftl b/assets/locales/it/errors.ftl index 6a319a2..d157988 100644 --- a/assets/locales/it/errors.ftl +++ b/assets/locales/it/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Patching del gioco non riuscito main-patch-update-failed = Scaricamento dell'ultima patch non riuscito +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Apertura dell'URL della documentazione non riuscita diff --git a/assets/locales/it/main.ftl b/assets/locales/it/main.ftl index 398cf3f..e872feb 100644 --- a/assets/locales/it/main.ftl +++ b/assets/locales/it/main.ftl @@ -54,6 +54,8 @@ components-index-updated = L'indice dei componenti è stato aggiornato launch = Lancia migrate-folders = Migra cartelle migrate-folders-tooltip = Aggiorna la struttura delle cartelle del gioco +apply-patch = Applica patch +disable-telemetry = Disable telemetry download-wine = Scarica wine create-prefix = Crea prefisso update = Aggiorna diff --git a/assets/locales/ja/errors.ftl b/assets/locales/ja/errors.ftl index e196ff3..fc66352 100644 --- a/assets/locales/ja/errors.ftl +++ b/assets/locales/ja/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = ゲームのパッチに失敗しました。 main-patch-update-failed = 最新のパッチのダウンロードに失敗しました。 +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = ドキュメントページを開けませんでした。 diff --git a/assets/locales/ja/main.ftl b/assets/locales/ja/main.ftl index 7e9f3df..66a926f 100644 --- a/assets/locales/ja/main.ftl +++ b/assets/locales/ja/main.ftl @@ -54,6 +54,8 @@ components-index-updated = コンポーネントインデックスが更新さ launch = 起動 migrate-folders = 移行ファイル migrate-folders-tooltip = ゲームフォルダ構成を更新 +apply-patch = パッチを適用する +disable-telemetry = Disable telemetry download-wine = ワインをダウンロード create-prefix = プレフィックスを作成 update = 更新 diff --git a/assets/locales/ru/errors.ftl b/assets/locales/ru/errors.ftl index fcc2e8d..a50b768 100644 --- a/assets/locales/ru/errors.ftl +++ b/assets/locales/ru/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Не удалось установить патч игры main-patch-update-failed = Не удалось скачать последнюю версию патча +# Disable telemetry + +telemetry-servers-disabling-error = Не удалось отключить серверы телеметрии + # Sandbox documentation-url-open-failed = Не удалось открыть ссылку с документацией diff --git a/assets/locales/ru/general.ftl b/assets/locales/ru/general.ftl index b599290..93675a4 100644 --- a/assets/locales/ru/general.ftl +++ b/assets/locales/ru/general.ftl @@ -55,7 +55,7 @@ apply-main-patch = Применять основной патч apply-main-patch-description = Экспериментально. Отключение опции позволяет запускать игру без применения патча. Это может не работать или требовать ручного изменения файлов. Используйте если знаете что делаете ask-superuser-permissions = Запрашивать права суперпользователя -ask-superuser-permissions-description = Лаунчер будет использовать их чтобы автоматически обновлять ваш hosts файл. Это не требуется при использовании flatpak +ask-superuser-permissions-description = Лаунчер будет использовать их чтобы автоматически обновлять ваш hosts файл для отключения телеметрии игры. Не требуется при использовании flatpak wine-tools = Инструменты Wine command-line = Коммандная строка diff --git a/assets/locales/ru/main.ftl b/assets/locales/ru/main.ftl index 2f3f26b..e4b5b66 100644 --- a/assets/locales/ru/main.ftl +++ b/assets/locales/ru/main.ftl @@ -60,6 +60,8 @@ components-index-updated = Индекс компонентов был обнов launch = Запустить migrate-folders = Переместить папки migrate-folders-tooltip = Обновить структуру файлов игры +apply-patch = Применить патч +disable-telemetry = Отключить телеметрию download-wine = Установить Wine create-prefix = Создать префикс update = Обновить diff --git a/assets/locales/ru/sandbox.ftl b/assets/locales/ru/sandbox.ftl index 33151d3..da55b77 100644 --- a/assets/locales/ru/sandbox.ftl +++ b/assets/locales/ru/sandbox.ftl @@ -4,7 +4,7 @@ sandbox-description = Запускать игру в изолированном enable-sandboxing = Использовать песочницу enable-sandboxing-description = Запускать игру в копии корневой файловой системы компьютера без прав на изменение файлов -hide-home-directory = Скрыть домашнюю директорию +hide-home-directory = Скрывать домашнюю директорию hide-home-directory-description = Изолировать ваши директории /home, /var/home/$USER, и $HOME от игры hostname = Имя хоста diff --git a/assets/locales/tr/errors.ftl b/assets/locales/tr/errors.ftl index cdc7f8e..6550cfd 100644 --- a/assets/locales/tr/errors.ftl +++ b/assets/locales/tr/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = Yamayı uygulamada sorun çıktı main-patch-update-failed = Güncel yama sürümü indirilemedi +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Belgelemenin URL'si açılamadı diff --git a/assets/locales/tr/main.ftl b/assets/locales/tr/main.ftl index dc5ffae..1bbd60f 100644 --- a/assets/locales/tr/main.ftl +++ b/assets/locales/tr/main.ftl @@ -54,6 +54,8 @@ components-index-updated = Bileşenlerin dizini güncellendi launch = Çalıştır migrate-folders = Dosyaları aktar migrate-folders-tooltip = Oyun dosyaları yapısını güncelle +apply-patch = Yamayı uygula +disable-telemetry = Disable telemetry download-wine = Wine indir create-prefix = Prefix oluştur update = Güncelle diff --git a/assets/locales/zh-cn/errors.ftl b/assets/locales/zh-cn/errors.ftl index 2076b21..d2ee948 100644 --- a/assets/locales/zh-cn/errors.ftl +++ b/assets/locales/zh-cn/errors.ftl @@ -46,6 +46,10 @@ game-patching-error = 应用游戏补丁失败 main-patch-update-failed = Failed to download latest patch version +# Disable telemetry + +telemetry-servers-disabling-error = Failed to disable telemetry servers + # Sandbox documentation-url-open-failed = Failed to open documentation URL diff --git a/assets/locales/zh-cn/main.ftl b/assets/locales/zh-cn/main.ftl index 669c0ec..c9d2857 100644 --- a/assets/locales/zh-cn/main.ftl +++ b/assets/locales/zh-cn/main.ftl @@ -54,6 +54,8 @@ components-index-updated = 组件索引已更新 launch = 启动 migrate-folders = 迁移目录 migrate-folders-tooltip = 更新游戏目录结构 +apply-patch = 安装补丁 +disable-telemetry = Disable telemetry download-wine = 下载 Wine create-prefix = 创建 Wine prefix update = 更新 diff --git a/src/main.rs b/src/main.rs index b71fd2f..0246aec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,8 +52,8 @@ lazy_static::lazy_static! { /// Path to `debug.log` file. Standard is `$HOME/.local/share/honkers-railway-launcher/debug.log` pub static ref DEBUG_FILE: PathBuf = LAUNCHER_FOLDER.join("debug.log"); - /// Path to `background` file. Standard is `$HOME/.cache/honkers-railway-launcher/background` - pub static ref BACKGROUND_FILE: PathBuf = CACHE_FOLDER.join("background"); + /// Path to `background` file. Standard is `$HOME/.local/share/honkers-railway-launcher/background` + pub static ref BACKGROUND_FILE: PathBuf = LAUNCHER_FOLDER.join("background"); /// Path to `.keep-background` file. Used to mark launcher that it shouldn't update background picture /// diff --git a/src/ui/about.rs b/src/ui/about.rs index 672768e..d1a1b18 100644 --- a/src/ui/about.rs +++ b/src/ui/about.rs @@ -93,36 +93,16 @@ impl SimpleComponent for AboutDialog { "

Added

", "", - - "

Fixed

", - - "", "

Changed

", "", - - "

Removed

", - - "", ].join("\n"), diff --git a/src/ui/main/disable_telemetry.rs b/src/ui/main/disable_telemetry.rs new file mode 100644 index 0000000..0885e61 --- /dev/null +++ b/src/ui/main/disable_telemetry.rs @@ -0,0 +1,68 @@ +use std::process::Command; + +use relm4::prelude::*; + +use crate::*; +use crate::i18n::*; + +use super::{App, AppMsg}; + +pub fn disable_telemetry(sender: ComponentSender) { + sender.input(AppMsg::DisableButtons(true)); + + let config = Config::get().unwrap(); + + std::thread::spawn(move || { + let telemetry = config.launcher.edition + .telemetry_servers() + .iter() + .map(|server| format!("0.0.0.0 {server}")) + .collect::>() + .join("\\n"); + + let output = if config.patch.root { + Command::new("pkexec") + .arg("echo") + .arg("-e") + .arg(format!("\\n{telemetry}\\n")) + .arg(">>") + .arg("/etc/hosts") + .spawn() + } + + else { + Command::new("echo") + .arg("-e") + .arg(format!("\\n{telemetry}\\n")) + .arg(">>") + .arg("/etc/hosts") + .spawn() + }; + + match output.and_then(|child| child.wait_with_output()) { + Ok(output) => if !output.status.success() { + tracing::error!("Failed to update /etc/hosts file"); + + sender.input(AppMsg::Toast { + title: tr("telemetry-servers-disabling-error"), + description: None // stdout/err is empty + }); + } + + Err(err) => { + tracing::error!("Failed to update /etc/hosts file"); + + sender.input(AppMsg::Toast { + title: tr("telemetry-servers-disabling-error"), + description: Some(err.to_string()) + }); + } + } + + sender.input(AppMsg::DisableButtons(false)); + sender.input(AppMsg::UpdateLauncherState { + perform_on_download_needed: false, + show_status_page: true + }); + }); +} diff --git a/src/ui/main/mod.rs b/src/ui/main/mod.rs index 731de75..d73ac99 100644 --- a/src/ui/main/mod.rs +++ b/src/ui/main/mod.rs @@ -14,6 +14,7 @@ mod update_patch; mod download_wine; mod create_prefix; mod download_diff; +mod disable_telemetry; mod launch; use anime_launcher_sdk::components::loader::ComponentsLoader; @@ -362,6 +363,8 @@ impl SimpleComponent for App { Some(LauncherState::PatchNotInstalled) | Some(LauncherState::PatchUpdateAvailable) => "document-save-symbolic", + Some(LauncherState::TelemetryNotDisabled) => "security-high-symbolic", + Some(LauncherState::WineNotInstalled) | Some(LauncherState::PrefixNotExists) => "document-save-symbolic", @@ -386,6 +389,8 @@ impl SimpleComponent for App { Some(LauncherState::PatchBroken) => tr("patch-broken"), Some(LauncherState::PatchUnsafe) => tr("patch-unsafe"), + Some(LauncherState::TelemetryNotDisabled) => tr("disable-telemetry"), + Some(LauncherState::WineNotInstalled) => tr("download-wine"), Some(LauncherState::PrefixNotExists) => tr("create-prefix"), @@ -952,6 +957,8 @@ impl SimpleComponent for App { LauncherState::PatchNotInstalled | LauncherState::PatchUpdateAvailable => update_patch::update_patch(sender, self.progress_bar.sender().to_owned()), + LauncherState::TelemetryNotDisabled => disable_telemetry::disable_telemetry(sender), + LauncherState::WineNotInstalled => download_wine::download_wine(sender, self.progress_bar.sender().to_owned()), LauncherState::PrefixNotExists => create_prefix::create_prefix(sender), diff --git a/src/ui/preferences/enhancements/mod.rs b/src/ui/preferences/enhancements/mod.rs index 437d440..871aa59 100644 --- a/src/ui/preferences/enhancements/mod.rs +++ b/src/ui/preferences/enhancements/mod.rs @@ -518,9 +518,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())