Adds a new file and returns its trunk ID. Creates a `TrunkOp::Create` for the file. Use [`add_line`](Self::add_line) to add content to the file.
(&mut self, path: &str, encoding: Option<Encoding>)
| 150 | /// Creates a `TrunkOp::Create` for the file. Use [`add_line`](Self::add_line) |
| 151 | /// to add content to the file. |
| 152 | pub fn add_file(&mut self, path: &str, encoding: Option<Encoding>) -> TrunkId { |
| 153 | let trunk_id = self.alloc_trunk_id(); |
| 154 | let file_op = FileOps::create(trunk_id, path.to_string(), encoding); |
| 155 | |
| 156 | let file_idx = self.file_ops.len(); |
| 157 | self.trunk_index.insert(trunk_id, file_idx); |
| 158 | self.file_ops.push(file_op); |
| 159 | |
| 160 | self.stats.files_added += 1; |
| 161 | trunk_id |
| 162 | } |
| 163 | |
| 164 | /// Adds a new file with content, automatically tokenizing into lines. |
| 165 | pub fn add_file_with_content( |