Skip to content

Commit

Permalink
Revert to libstd's remove_dir_all instead of external crate.
Browse files Browse the repository at this point in the history
This avoids the Windows dependencies.
The bug that caused us to switch to the crate in the first place was
addressed in Rust 1.66+ (rust-lang/rust#104558)
  • Loading branch information
badboy committed Mar 14, 2023
1 parent 2e8853b commit fea28db
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 145 deletions.
155 changes: 14 additions & 141 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion glean-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ crossbeam-channel = "0.5"
thiserror = "1.0.4"
uniffi = { version = "0.23.0", default-features = false }
time = "0.1.40"
remove_dir_all = "0.8.1"
env_logger = { version = "0.10.0", default-features = false, optional = true }

[target.'cfg(target_os = "android")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion glean-core/src/event_database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ impl EventDatabase {

// safe unwrap, only error case is poisoning
let _lock = self.file_lock.write().unwrap();
remove_dir_all::remove_dir_all(&self.path)?;
std::fs::remove_dir_all(&self.path)?;
create_dir_all(&self.path)?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion glean-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ pub fn glean_test_destroy_glean(clear_stores: bool, data_path: Option<String>) {
INITIALIZE_CALLED.store(false, Ordering::SeqCst);
} else if clear_stores {
if let Some(data_path) = data_path {
let _ = remove_dir_all::remove_dir_all(data_path).ok();
let _ = std::fs::remove_dir_all(data_path).ok();
} else {
log::warn!("Asked to clear stores before initialization, but no data path given.");
}
Expand Down
2 changes: 1 addition & 1 deletion glean-core/src/ping/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ impl PingMaker {
pub fn clear_pending_pings(&self, data_path: &Path) -> Result<()> {
let pings_dir = self.get_pings_dir(data_path, None)?;

remove_dir_all::remove_dir_all(&pings_dir)?;
std::fs::remove_dir_all(&pings_dir)?;
create_dir_all(&pings_dir)?;

log::debug!("All pending pings deleted");
Expand Down

0 comments on commit fea28db

Please sign in to comment.