now detects documents

This commit is contained in:
2026-05-17 03:00:47 +02:00
parent ae21fe1d98
commit f1a245ef19
5 changed files with 53 additions and 83 deletions
+20
View File
@@ -0,0 +1,20 @@
const std = @import("std");
pub const Category = enum { image, document, music, video, code, other };
const DocumentTypes = [_][]const u8{ ".pdf", ".docx", ".odt" };
pub fn classify(name: []const u8) Category {
const extension = std.fs.path.extension(name);
for (DocumentTypes) |ext| {
const eicDocument = std.ascii.eqlIgnoreCase(extension, ext);
if (eicDocument) {
std.debug.print("document found! \n", .{});
return .document;
}
}
std.debug.print("no document found! \n", .{});
return .other;
}