mirror of
https://git.aramjonghu.nl/AramJonghu/file-organizer.git
synced 2026-06-06 17:48:23 +02:00
now detects documents
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user