fix: prevent duplicate files in project file index
This commit is contained in:
parent
5988ff69d4
commit
ca0a1c69a5
1 changed files with 2 additions and 0 deletions
|
|
@ -784,6 +784,8 @@ fn loaded(self: *Self, parent: tp.pid_ref) OutOfMemoryError!void {
|
|||
pub fn file_added(self: *Self, file_path: []const u8) OutOfMemoryError!void {
|
||||
for (self.files.items) |file|
|
||||
if (std.mem.eql(u8, file.path, file_path)) return;
|
||||
for (self.pending.items) |file|
|
||||
if (std.mem.eql(u8, file.path, file_path)) return;
|
||||
const file_type, const file_icon, const file_color = guess_file_type(file_path);
|
||||
(try self.files.addOne(self.allocator)).* = .{
|
||||
.path = try self.allocator.dupe(u8, file_path),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue