mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-07-14 19:10:28 +03:00
fix(cli): Truncate BuildTask.kt before writing (#9015)
* truncate BuildTask.kt before write * Create truncate-before-write-buildtask.md * remove unused checks --------- Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
parent
04440edce8
commit
b658ded614
6
.changes/truncate-before-write-buildtask.md
Normal file
6
.changes/truncate-before-write-buildtask.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:bug
|
||||
"@tauri-apps/cli": patch:bug
|
||||
---
|
||||
|
||||
Fixes truncation of existing BuildTask.kt when running `tauri android init`.
|
@ -211,7 +211,9 @@ fn generate_out_file(
|
||||
options.mode(0o755);
|
||||
}
|
||||
|
||||
if path.file_name().unwrap() == OsStr::new("BuildTask.kt") || !path.exists() {
|
||||
if path.file_name().unwrap() == OsStr::new("BuildTask.kt") {
|
||||
options.truncate(true).create(true).open(path).map(Some)
|
||||
} else if !path.exists() {
|
||||
options.create(true).open(path).map(Some)
|
||||
} else {
|
||||
Ok(None)
|
||||
|
@ -155,7 +155,7 @@ pub fn gen(
|
||||
let mut options = OpenOptions::new();
|
||||
options.write(true);
|
||||
|
||||
if path.file_name().unwrap() == OsStr::new("BuildTask.kt") || !path.exists() {
|
||||
if !path.exists() {
|
||||
options.create(true).open(path).map(Some)
|
||||
} else {
|
||||
Ok(None)
|
||||
|
@ -274,7 +274,7 @@ pub fn generate_android_out_file(
|
||||
options.mode(0o755);
|
||||
}
|
||||
|
||||
if path.file_name().unwrap() == OsStr::new("BuildTask.kt") || !path.exists() {
|
||||
if !path.exists() {
|
||||
options.create(true).open(path).map(Some)
|
||||
} else {
|
||||
Ok(None)
|
||||
|
Loading…
Reference in New Issue
Block a user