refactor: used std::env::temp_dir() instead of std::path::PathBuf::from("/tmp")

This commit is contained in:
Observer KRypt0n_ 2023-03-23 14:27:47 +02:00
parent b5f8f7a490
commit 2d81e50e68
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
3 changed files with 5 additions and 5 deletions

@ -1 +1 @@
Subproject commit c977382d270f1414c1691077120516ff27f01ee4
Subproject commit e1ec9f7796763de558ca49c9c15dae864db9fcda

View file

@ -239,7 +239,7 @@ impl SimpleAsyncComponent for DefaultPathsApp {
patch: CONFIG.patch.path.clone(),
#[allow(clippy::or_fun_call)]
temp: CONFIG.launcher.temp.clone().unwrap_or(PathBuf::from("/tmp"))
temp: CONFIG.launcher.temp.clone().unwrap_or(std::env::temp_dir())
};
let widgets = view_output!();

View file

@ -322,7 +322,7 @@ impl SimpleComponent for App {
set_sensitive: match model.state.as_ref() {
Some(LauncherState::PredownloadAvailable { game, voices }) => {
let config = config::get().unwrap();
let temp = config.launcher.temp.unwrap_or_else(|| PathBuf::from("/tmp"));
let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir);
let downloaded = temp.join(game.file_name().unwrap()).exists() &&
voices.iter().all(|voice| temp.join(voice.file_name().unwrap()).exists());
@ -337,7 +337,7 @@ impl SimpleComponent for App {
set_css_classes: match model.state.as_ref() {
Some(LauncherState::PredownloadAvailable { game, voices }) => {
let config = config::get().unwrap();
let temp = config.launcher.temp.unwrap_or_else(|| PathBuf::from("/tmp"));
let temp = config.launcher.temp.unwrap_or_else(std::env::temp_dir);
let downloaded = temp.join(game.file_name().unwrap()).exists() &&
voices.iter().all(|voice| temp.join(voice.file_name().unwrap()).exists());
@ -893,7 +893,7 @@ impl SimpleComponent for App {
#[allow(unused_must_use)]
AppMsg::PredownloadUpdate => {
if let Some(LauncherState::PredownloadAvailable { game, mut voices }) = self.state.clone() {
let tmp = config::get().unwrap().launcher.temp.unwrap_or_else(|| PathBuf::from("/tmp"));
let tmp = config::get().unwrap().launcher.temp.unwrap_or_else(std::env::temp_dir);
self.downloading = true;