mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-04-06 03:40:59 +01:00
feat(engines): report version resolving
Improves user experience when running engines by reporting that it is currently resolving the version of the engine to download.
This commit is contained in:
parent
f4050abec8
commit
380a716200
1 changed files with 25 additions and 25 deletions
|
@ -193,6 +193,11 @@ pub async fn get_or_download_engine(
|
|||
.with_extension(std::env::consts::EXE_EXTENSION));
|
||||
}
|
||||
|
||||
run_with_reporter(|_, root_progress, reporter| async {
|
||||
let root_progress = root_progress;
|
||||
let reporter = reporter;
|
||||
|
||||
root_progress.set_message("resolve version");
|
||||
let mut versions = source
|
||||
.resolve(
|
||||
&req,
|
||||
|
@ -204,23 +209,6 @@ pub async fn get_or_download_engine(
|
|||
.context("failed to resolve versions")?;
|
||||
let (version, engine_ref) = versions.pop_last().context("no matching versions found")?;
|
||||
|
||||
let path = path.join(version.to_string());
|
||||
|
||||
fs::create_dir_all(&path)
|
||||
.await
|
||||
.context("failed to create engine container folder")?;
|
||||
|
||||
let path = path
|
||||
.join(source.expected_file_name())
|
||||
.with_extension(std::env::consts::EXE_EXTENSION);
|
||||
|
||||
let mut file = fs::File::create(&path)
|
||||
.await
|
||||
.context("failed to create new file")?;
|
||||
|
||||
run_with_reporter(|_, root_progress, reporter| async {
|
||||
let root_progress = root_progress;
|
||||
|
||||
root_progress.set_message("download");
|
||||
|
||||
let reporter = reporter.report_download(format!("{engine} v{version}"));
|
||||
|
@ -237,6 +225,18 @@ pub async fn get_or_download_engine(
|
|||
.await
|
||||
.context("failed to download engine")?;
|
||||
|
||||
let path = path.join(version.to_string());
|
||||
fs::create_dir_all(&path)
|
||||
.await
|
||||
.context("failed to create engine container folder")?;
|
||||
let path = path
|
||||
.join(source.expected_file_name())
|
||||
.with_extension(std::env::consts::EXE_EXTENSION);
|
||||
|
||||
let mut file = fs::File::create(&path)
|
||||
.await
|
||||
.context("failed to create new file")?;
|
||||
|
||||
tokio::io::copy(
|
||||
&mut archive
|
||||
.find_executable(source.expected_file_name())
|
||||
|
|
Loading…
Add table
Reference in a new issue