Skip to content

Commit de22f34

Browse files
committed
[rust] Replace function for creating parent path if not exists
1 parent 9e33a0b commit de22f34

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

rust/src/files.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ impl BrowserPath {
6767
}
6868
}
6969

70-
pub fn create_empty_parent_path_if_not_exists(path: &Path) -> Result<(), Error> {
71-
if let Some(p) = path.parent() {
72-
create_path_if_not_exists(p)?;
73-
fs::remove_dir_all(p).and_then(|_| fs::create_dir(p))?;
74-
}
75-
Ok(())
76-
}
77-
7870
pub fn create_parent_path_if_not_exists(path: &Path) -> Result<(), Error> {
7971
if let Some(p) = path.parent() {
8072
create_path_if_not_exists(p)?;
@@ -185,7 +177,7 @@ pub fn uncompress_sfx(compressed_file: &str, target: &Path, log: &Logger) -> Res
185177
"Moving extracted files and folders from {} to {}",
186178
core_str, target_str
187179
));
188-
create_empty_parent_path_if_not_exists(target)?;
180+
create_parent_path_if_not_exists(target)?;
189181
fs::rename(&core_str, &target_str)?;
190182

191183
Ok(())
@@ -291,7 +283,7 @@ pub fn uncompress_deb(
291283
"Moving extracted files and folders from {} to {}",
292284
opt_edge_str, target_str
293285
));
294-
create_empty_parent_path_if_not_exists(target)?;
286+
create_parent_path_if_not_exists(target)?;
295287
fs::rename(&opt_edge_str, &target_str)?;
296288

297289
Ok(())

0 commit comments

Comments
 (0)