fix: renames of project files are deletes if the target already exists
This commit is contained in:
parent
86b50b1329
commit
ea025be08b
1 changed files with 5 additions and 0 deletions
|
|
@ -808,6 +808,11 @@ pub fn file_modified(self: *Self, file_path: []const u8) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn file_renamed(self: *Self, from_path: []const u8, to_path: []const u8) OutOfMemoryError!void {
|
pub fn file_renamed(self: *Self, from_path: []const u8, to_path: []const u8) OutOfMemoryError!void {
|
||||||
|
for (self.files.items) |*file| {
|
||||||
|
if (!std.mem.eql(u8, file.path, to_path)) continue;
|
||||||
|
self.file_deleted(from_path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (self.files.items) |*file| {
|
for (self.files.items) |*file| {
|
||||||
if (!std.mem.eql(u8, file.path, from_path)) continue;
|
if (!std.mem.eql(u8, file.path, from_path)) continue;
|
||||||
const new_path = try self.allocator.dupe(u8, to_path);
|
const new_path = try self.allocator.dupe(u8, to_path);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue