From a1a21c4024350019994fc4e3e6243c8610813a84 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Wed, 5 Jun 2024 21:35:20 -0600 Subject: [PATCH] fix: delete old /pkg when new one is unzipped to there --- kinode/packages/app_store/app_store/src/utils.rs | 9 +++++++++ kinode/src/state.rs | 2 ++ 2 files changed, 11 insertions(+) diff --git a/kinode/packages/app_store/app_store/src/utils.rs b/kinode/packages/app_store/app_store/src/utils.rs index 003d43465..c7dfcfba0 100644 --- a/kinode/packages/app_store/app_store/src/utils.rs +++ b/kinode/packages/app_store/app_store/src/utils.rs @@ -253,6 +253,15 @@ pub fn create_package_drive( })?) .send_and_await_response(VFS_TIMEOUT)??; + // DELETE the /pkg folder in the package drive + // in order to replace with the fresh one + Request::to(("our", "vfs", "distro", "sys")) + .body(serde_json::to_vec(&vfs::VfsRequest { + path: drive_name.clone(), + action: vfs::VfsAction::RemoveDirAll, + })?) + .send_and_await_response(VFS_TIMEOUT)??; + // convert the zip to a new package drive let response = Request::to(("our", "vfs", "distro", "sys")) .body(serde_json::to_vec(&vfs::VfsRequest { diff --git a/kinode/src/state.rs b/kinode/src/state.rs index 971ebc227..7e81e90bd 100644 --- a/kinode/src/state.rs +++ b/kinode/src/state.rs @@ -403,6 +403,8 @@ async fn bootstrap( // create a new package in VFS let our_drive_name = [package_name, package_publisher].join(":"); let pkg_path = format!("{}/vfs/{}/pkg", &home_directory_path, &our_drive_name); + // delete anything currently residing in the pkg folder + fs::remove_dir_all(&pkg_path).await?; fs::create_dir_all(&pkg_path) .await .expect("bootstrap vfs dir pkg creation failed!");