Enhance OSDK performance by reusing existing base, bundle and build

This commit is contained in:
Ruize Tang
2024-12-09 16:25:49 +08:00
committed by Tate, Hongliang Tian
parent 3bbdc68d39
commit 858e95ed4d
12 changed files with 174 additions and 76 deletions

View File

@ -83,12 +83,11 @@ impl AsterBin {
self.stripped
}
/// Move the binary to the `base` directory and convert the path to a relative path.
pub fn move_to(self, base: impl AsRef<Path>) -> Self {
/// Copy the binary to the `base` directory and convert the path to a relative path.
pub fn copy_to(self, base: impl AsRef<Path>) -> Self {
let file_name = self.path.file_name().unwrap();
let copied_path = base.as_ref().join(file_name);
fs::copy(&self.path, copied_path).unwrap();
fs::remove_file(&self.path).unwrap();
Self {
path: PathBuf::from(file_name),
arch: self.arch,