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
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let icon_path = if let Some(marketplace_url) = &marketplace_url {
|
let icon_path = if let Some(manifest) = &manifest {
|
||||||
if let Some(manifest) = &manifest {
|
|
||||||
let dir = ctx
|
let dir = ctx
|
||||||
.datadir
|
.datadir
|
||||||
.join(PKG_PUBLIC_DIR)
|
.join(PKG_PUBLIC_DIR)
|
||||||
@@ -847,6 +846,7 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin + Send + Sync>(
|
|||||||
.join(manifest.version.as_str());
|
.join(manifest.version.as_str());
|
||||||
let icon_path = dir.join(format!("icon.{}", manifest.assets.icon_type()));
|
let icon_path = dir.join(format!("icon.{}", manifest.assets.icon_type()));
|
||||||
if tokio::fs::metadata(&icon_path).await.is_err() {
|
if tokio::fs::metadata(&icon_path).await.is_err() {
|
||||||
|
if let Some(marketplace_url) = &marketplace_url {
|
||||||
tokio::fs::create_dir_all(&dir).await?;
|
tokio::fs::create_dir_all(&dir).await?;
|
||||||
let icon = ctx
|
let icon = ctx
|
||||||
.client
|
.client
|
||||||
@@ -864,11 +864,13 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin + Send + Sync>(
|
|||||||
let mut dst = File::create(&icon_path).await?;
|
let mut dst = File::create(&icon_path).await?;
|
||||||
tokio::io::copy(&mut response_to_reader(icon), &mut dst).await?;
|
tokio::io::copy(&mut response_to_reader(icon), &mut dst).await?;
|
||||||
dst.sync_all().await?;
|
dst.sync_all().await?;
|
||||||
}
|
|
||||||
Some(icon_path)
|
Some(icon_path)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Some(icon_path)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user