summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--installer-downloader/src/controller.rs2
-rw-r--r--installer-downloader/src/temp.rs15
-rw-r--r--installer-downloader/tests/controller.rs1
3 files changed, 11 insertions, 7 deletions
diff --git a/installer-downloader/src/controller.rs b/installer-downloader/src/controller.rs
index 21931af231..c679a338ea 100644
--- a/installer-downloader/src/controller.rs
+++ b/installer-downloader/src/controller.rs
@@ -88,7 +88,7 @@ impl AppController {
D: AppDelegate + 'static,
V: VersionInfoProvider + Send + 'static,
A: From<UiAppDownloaderParameters<D>> + AppDownloader + 'static,
- DirProvider: DirectoryProvider,
+ DirProvider: DirectoryProvider + 'static,
{
delegate.hide_download_progress();
delegate.show_download_button();
diff --git a/installer-downloader/src/temp.rs b/installer-downloader/src/temp.rs
index 95487e10d1..84bf506dc4 100644
--- a/installer-downloader/src/temp.rs
+++ b/installer-downloader/src/temp.rs
@@ -14,28 +14,31 @@
//! by the current user. Using a random directory name mitigates this issue.
use anyhow::Context;
-use std::{future::Future, path::PathBuf};
+use async_trait::async_trait;
+use std::path::PathBuf;
/// Provide a directory to use for [AppDownloader]
-pub trait DirectoryProvider: 'static {
+#[async_trait]
+pub trait DirectoryProvider {
/// Provide a directory to use for [AppDownloader]
- fn create_download_dir() -> impl Future<Output = anyhow::Result<PathBuf>> + Send;
+ async fn create_download_dir() -> anyhow::Result<PathBuf>;
}
/// See [module-level](self) docs.
pub struct TempDirProvider;
+#[async_trait]
impl DirectoryProvider for TempDirProvider {
/// Create a locked-down directory to store downloads in
- fn create_download_dir() -> impl Future<Output = anyhow::Result<PathBuf>> + Send {
+ async fn create_download_dir() -> anyhow::Result<PathBuf> {
#[cfg(windows)]
{
- admin_temp_dir()
+ admin_temp_dir().await
}
#[cfg(target_os = "macos")]
{
- temp_dir()
+ temp_dir().await
}
}
}
diff --git a/installer-downloader/tests/controller.rs b/installer-downloader/tests/controller.rs
index f8b26a60e6..031d5c153d 100644
--- a/installer-downloader/tests/controller.rs
+++ b/installer-downloader/tests/controller.rs
@@ -48,6 +48,7 @@ impl VersionInfoProvider for FakeVersionInfoProvider {
pub struct FakeDirectoryProvider<const SUCCEED: bool> {}
+#[async_trait::async_trait]
impl<const SUCCEEDED: bool> DirectoryProvider for FakeDirectoryProvider<SUCCEEDED> {
async fn create_download_dir() -> anyhow::Result<PathBuf> {
if SUCCEEDED {