Skip to content

Commit c450fae

Browse files
committed
fix(integration): create parent dir if doesn't exist
1 parent 83b2813 commit c450fae

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

soar-core/src/package/formats/common.rs

-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ pub async fn symlink_icon<P: AsRef<Path>>(real_path: P, pkg_name: &str) -> SoarR
8787
home_data_path()
8888
));
8989

90-
if let Some(parent) = final_path.parent() {
91-
fs::create_dir_all(parent)?;
92-
}
93-
9490
create_symlink(real_path, &final_path)?;
9591
Ok(final_path)
9692
}

soar-core/src/utils.rs

+5
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ pub fn calc_magic_bytes<P: AsRef<Path>>(file_path: P, size: usize) -> Result<Vec
156156

157157
pub fn create_symlink<P: AsRef<Path>>(from: P, to: P) -> SoarResult<()> {
158158
let to = to.as_ref();
159+
160+
if let Some(parent) = to.parent() {
161+
fs::create_dir_all(parent)?;
162+
}
163+
159164
if to.is_symlink() {
160165
fs::remove_file(to)?;
161166
}

0 commit comments

Comments
 (0)