Skip to content

Commit ea8eadc

Browse files
authored
fix(fs): match default value of create option with js documentation (#865)
* fix(fs): inconsistency in guest-js & rust side * Update .changes/fix-fs-write-default-option.md
1 parent be5aebd commit ea8eadc

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"fs": "patch"
3+
"fs-js": "patch"
4+
---
5+
6+
Fix incorrect `create` option default value for `writeFile` and `writeTextFile` which didn't match documentation.

plugins/fs/src/commands.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,14 +585,18 @@ pub struct WriteFileOptions {
585585
base: BaseOptions,
586586
#[serde(default)]
587587
append: bool,
588-
#[serde(default)]
588+
#[serde(default = "default_create_value")]
589589
create: bool,
590590
#[serde(default)]
591591
create_new: bool,
592592
#[allow(unused)]
593593
mode: Option<u32>,
594594
}
595595

596+
fn default_create_value() -> bool {
597+
true
598+
}
599+
596600
fn write_file_inner<R: Runtime>(
597601
app: AppHandle<R>,
598602
path: SafePathBuf,

0 commit comments

Comments
 (0)