(
_state: &mut State<'gc>,
args: Vec<Value<'gc>>,
)
| 115 | } |
| 116 | |
| 117 | fn io_append_file<'gc>( |
| 118 | _state: &mut State<'gc>, |
| 119 | args: Vec<Value<'gc>>, |
| 120 | ) -> Result<Value<'gc>, VmError> { |
| 121 | let path = string_arg!(args, 0, "append_file")?.to_string(); |
| 122 | let content = string_arg!(args, 1, "append_file")?.to_string(); |
| 123 | |
| 124 | let mut file = OpenOptions::new() |
| 125 | .create(true) |
| 126 | .append(true) |
| 127 | .open(&path) |
| 128 | .map_err(|e| VmError::RuntimeError(format!("Failed to open file '{}': {}", path, e)))?; |
| 129 | |
| 130 | file.write_all(content.as_bytes()).map_err(|e| { |
| 131 | VmError::RuntimeError(format!("Failed to append to file '{}': {}", path, e)) |
| 132 | })?; |
| 133 | |
| 134 | Ok(Value::Boolean(true)) |
| 135 | } |
| 136 | |
| 137 | fn io_input<'gc>(state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
| 138 | // Optional input |
nothing calls this directly
no test coverage detected