ls but with io_uring

icons: prioritize entry kind vs extension

rockorager.dev ac72b537 f78dad4e

verified
+8 -8
+8 -8
src/main.zig
··· 1130 1130 1131 1131 fn get(entry: Entry, opts: Options) Icon { 1132 1132 // 1. By name 1133 - // 2. By extension 1134 - // 3. By type 1133 + // 2. By type 1134 + // 3. By extension 1135 1135 if (by_name.get(entry.name)) |icon| return icon; 1136 1136 1137 - const ext = std.fs.path.extension(entry.name); 1138 - if (ext.len > 0) { 1139 - const ft = ext[1..]; 1140 - if (by_extension.get(ft)) |icon| return icon; 1141 - } 1142 - 1143 1137 switch (entry.kind) { 1144 1138 .block_device => return drive, 1145 1139 .character_device => return drive, 1146 1140 .directory => return directory, 1147 1141 .file => { 1142 + const ext = std.fs.path.extension(entry.name); 1143 + if (ext.len > 0) { 1144 + const ft = ext[1..]; 1145 + if (by_extension.get(ft)) |icon| return icon; 1146 + } 1147 + 1148 1148 if (entry.isExecutable()) { 1149 1149 return executable; 1150 1150 }