no tar for scripts

This commit is contained in:
Keagan McClelland
2022-05-12 13:35:52 -06:00
parent 93ee418f65
commit f44d432b6a
2 changed files with 8 additions and 6 deletions

View File

@@ -1123,9 +1123,12 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
if tokio::fs::metadata(&script_dir).await.is_err() {
tokio::fs::create_dir_all(&script_dir).await?;
}
if let Some(hdl) = rdr.scripts().await? {
let mut tar = tokio_tar::Archive::new(hdl);
tar.unpack(script_dir).await?;
if let Some(mut hdl) = rdr.scripts().await? {
tokio::io::copy(
&mut hdl,
&mut File::open(script_dir.join("embassy.js")).await?,
)
.await?;
}
Ok(())

View File

@@ -106,9 +106,8 @@ pub fn pack(#[context] ctx: SdkContext, #[arg] path: Option<PathBuf>) -> Result<
std::io::Cursor::new(assets.into_inner()?)
})
.scripts({
let mut scripts = tar::Builder::new(Vec::new());
scripts.append_dir_all("scripts", path.join(manifest.assets.scripts_path()))?;
std::io::Cursor::new(scripts.into_inner()?)
let script_path = path.join(manifest.assets.scripts_path()).join("embassy.js");
File::open(script_path)?
})
.build()
.pack(&ctx.developer_key()?)?;