Skip to content

Commit 732c9ab

Browse files
committed
[WARP] Return existing source id when adding a file to a disk container
Removes the need to book keep on the caller side
1 parent d926a19 commit 732c9ab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/warp/src/container/disk.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ impl Container for DiskContainer {
8989
fn add_source(&mut self, path: SourcePath) -> ContainerResult<SourceId> {
9090
// Disk sources have there source id computed from the path.
9191
let source_id = path.to_source_id();
92-
self.insert_source(source_id, path)?;
92+
match self.insert_source(source_id, path) {
93+
Ok(()) => {}
94+
Err(ContainerError::SourceAlreadyExists(_)) => {}
95+
Err(err) => return Err(err),
96+
}
9397
Ok(source_id)
9498
}
9599

0 commit comments

Comments
 (0)