commit 5b1284cbb56963315c6576b39c7e1329fc9954e8
parent d697bf7ee74e0e3dc476c176a392269530ff6c74
Author: Árni Dagur <agudmundsson@fc-md.umd.edu>
Date: Sun, 5 Apr 2020 03:59:39 -0400
Bugfix: Allow overwriting existing file in 'serialize_to_file'
Diffstat:
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "adblock"
publish = false
-version = "0.1.1"
+version = "0.1.2"
authors = ["Árni Dagur <arni@dagur.eu"]
edition = "2018"
diff --git a/pyproject.toml b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "adblock"
-version = "0.1.1"
+version = "0.1.2"
description = "Brave's adblocking in Python"
authors = ["Árni Dagur <arni@dagur.eu>"]
license = "Apache-2.0"
diff --git a/src/lib.rs b/src/lib.rs
@@ -199,7 +199,8 @@ impl Engine {
pub fn serialize_to_file(&mut self, file: &str) -> PyResult<()> {
let mut fd = fs::OpenOptions::new()
- .create_new(true)
+ .create(true)
+ .truncate(true)
.write(true)
.open(file)?;
let data = self.serialize()?;