fix: keep existing contents in create_file
This commit is contained in:
@@ -19,6 +19,12 @@ fn safe_create_file(path: PathBuf) -> Result<File, std::io::Error> {
|
|||||||
OpenOptions::new().write(true).create_new(true).open(path)
|
OpenOptions::new().write(true).create_new(true).open(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// truncate(false) keeps an existing file's contents, which is what callers creating
|
||||||
|
// an empty __init__.py want
|
||||||
fn create_file(path: PathBuf) -> Result<File, std::io::Error> {
|
fn create_file(path: PathBuf) -> Result<File, std::io::Error> {
|
||||||
OpenOptions::new().write(true).create(true).open(path)
|
OpenOptions::new()
|
||||||
|
.write(true)
|
||||||
|
.create(true)
|
||||||
|
.truncate(false)
|
||||||
|
.open(path)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user