mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
use existing dependency icon if available (#2489)
This commit is contained in:
@@ -838,8 +838,7 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin + Send + Sync>(
|
||||
None
|
||||
};
|
||||
|
||||
let icon_path = if let Some(marketplace_url) = &marketplace_url {
|
||||
if let Some(manifest) = &manifest {
|
||||
let icon_path = if let Some(manifest) = &manifest {
|
||||
let dir = ctx
|
||||
.datadir
|
||||
.join(PKG_PUBLIC_DIR)
|
||||
@@ -847,6 +846,7 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin + Send + Sync>(
|
||||
.join(manifest.version.as_str());
|
||||
let icon_path = dir.join(format!("icon.{}", manifest.assets.icon_type()));
|
||||
if tokio::fs::metadata(&icon_path).await.is_err() {
|
||||
if let Some(marketplace_url) = &marketplace_url {
|
||||
tokio::fs::create_dir_all(&dir).await?;
|
||||
let icon = ctx
|
||||
.client
|
||||
@@ -864,11 +864,13 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin + Send + Sync>(
|
||||
let mut dst = File::create(&icon_path).await?;
|
||||
tokio::io::copy(&mut response_to_reader(icon), &mut dst).await?;
|
||||
dst.sync_all().await?;
|
||||
}
|
||||
Some(icon_path)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
Some(icon_path)
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user