5
5
#include <stdarg.h>
6
6
#include <string.h>
7
7
#include <strings.h>
8
+ #include <stdio.h>
8
9
9
10
// Default file icon is text file or normal link file
10
11
#define DEFAULT_FILE_ICON "\uf15c"
@@ -21,6 +22,11 @@ static bool find_in(const char *of, const char *values, bool is_exact_match);
21
22
#define IS (of , values ) find_in(of, values, true)
22
23
#define BEGINS (of , values ) find_in(of, values, false)
23
24
25
+ #define BITMAP_IMAGE \
26
+ "png, jpg, jpeg, gif, webp, bmp, ppm, pgm, pbm, pnm, tiff, ico, xbm, xpm" \
27
+ "tga, avif, jp2, j2k, jxl, qoi, ktx, dds, wal"
28
+ #define VECTOR_IMAGE "svg, ai, eps"
29
+
24
30
#define LOSSLESS_AUDIO \
25
31
"8svx, iff, aiff, aif, aifc, au, snd, bwf, wav, wave, cdda, raw, pcm, sam, ra, ram, " \
26
32
"flac, la, pac, ape, ofr, ofs, off, rka, shn, tak, tta, wv, brstm, dts, dtshd, dtsma, " \
@@ -32,6 +38,10 @@ static bool find_in(const char *of, const char *values, bool is_exact_match);
32
38
33
39
#define VIDEO "avi, flv, mkv, mov, mp4, ogv, webm"
34
40
41
+ #define MODEL_3D \
42
+ "obj, gltf, glb, blend, 3ds, ase, dae, vta, mdl, md2, md3, mdc, md5mesh, " \
43
+ "md5anim, md5camera, irr, irrmesh, ply, ac3d, vtk"
44
+
35
45
static const bool is_default_icon (const char * icon )
36
46
{
37
47
return strcmp (icon , DEFAULT_FILE_ICON ) == 0 || strcmp (icon , DEFAULT_LINK_FILE_ICON ) == 0 ;
@@ -88,7 +98,7 @@ static const char *get_file_icon_by_ext(const char *ext, const bool is_link)
88
98
89
99
else if (IS (ext , "json" )) return "\ue60b" ;
90
100
else if (IS (ext , "lock" )) return "\uf023" ;
91
- else if (IS (ext , "ini, yaml, yml, env, toml" )) return "\ue615" ;
101
+ else if (IS (ext , "ini, yaml, yml, env, toml, conf, cfg " )) return "\ue615" ;
92
102
93
103
// Data handling / manipulation
94
104
@@ -102,12 +112,22 @@ static const char *get_file_icon_by_ext(const char *ext, const bool is_link)
102
112
103
113
// Terminal stuff
104
114
105
- else if (IS (ext , "zsh, bash, sh" )) return "\ue795" ;
115
+ else if (IS (ext , "zsh, bash, sh, ps1 " )) return "\ue795" ;
106
116
else if (BEGINS (ext , "zsh, bash" )) return "\ue615" ;
107
117
else if (BEGINS (ext , "vim" )) return "\ue7c5" ;
108
118
109
119
// Databases
110
- else if (IS (ext , "sql, sqlite" )) return "\ue706" ;
120
+ else if (IS (ext , "sql, sqlite, db" )) return "\ue706" ;
121
+
122
+ // Archive
123
+ else if (IS (ext , "zip, rar, 7z, tar, a, ar, cab, pk3" )) return "\uf187" ;
124
+
125
+ // Fonts
126
+ else if (IS (ext , "ttf, otf, woff, woff2, eot" )) return "\ue659" ;
127
+
128
+ // Image
129
+ else if (IS (ext , BITMAP_IMAGE )) return "\ue60d" ;
130
+ else if (IS (ext , VECTOR_IMAGE )) return "\uee24" ;
111
131
112
132
// Audio
113
133
// lossless
@@ -119,6 +139,10 @@ static const char *get_file_icon_by_ext(const char *ext, const bool is_link)
119
139
120
140
// Video
121
141
else if (IS (ext , VIDEO )) return "\uf03d" ;
142
+
143
+ // 3d Models and related
144
+ else if (IS (ext , MODEL_3D )) return "\uf1b2" ;
145
+
122
146
// Languages
123
147
124
148
// C, C++
@@ -169,6 +193,17 @@ static const char *get_file_icon_by_ext(const char *ext, const bool is_link)
169
193
else if (IS (ext , "swift" )) return "\ue755" ;
170
194
// Typescript
171
195
else if (IS (ext , "ts, tsx" )) return "\ue69d" ;
196
+ // Qt stuff
197
+ else if (IS (ext , "qml, qrc, qsb, qss" )) return "\uf375" ;
198
+
199
+ // Misc.
200
+ else if (IS (ext , "pdf" )) return "\ue67d" ;
201
+ else if (IS (ext , "torrent" )) return "\uf0ec" ;
202
+ else if (IS (ext , "log" )) return "\uf1ea" ;
203
+ else if (IS (ext , "exe" )) return "\ue70f" ;
204
+ else if (IS (ext , "cache" )) return "\uf49b" ;
205
+ else if (IS (ext , "sln" )) return "\ue70c" ;
206
+ else if (IS (ext , "desktop" )) return "\uf108" ;
172
207
173
208
if (is_link ) return DEFAULT_LINK_FILE_ICON ;
174
209
return DEFAULT_FILE_ICON ;
@@ -177,11 +212,14 @@ static const char *get_file_icon_by_ext(const char *ext, const bool is_link)
177
212
static const char * get_file_icon_by_name (const char * name , const bool is_link )
178
213
{
179
214
// Development
180
- if (BEGINS (name , "Makefile" )) return "\ue673" ;
215
+ if (BEGINS (name , "Makefile, CMake " )) return "\ue673" ;
181
216
else if (BEGINS (name , "Dockerfile, docker-compose" )) return "\uf308" ;
182
217
183
218
// Other
184
219
if (BEGINS (name , "LICENSE, license, copying, COPYING" )) return "\uf2c2" ;
220
+ else if (BEGINS (name , "AUTHOR, author, CONTRIBUTOR, contributor" )) return "\uf4fd" ;
221
+ else if (IS (name , "config" )) return "\ue615" ;
222
+ else if (IS (name , "TODO, todo, TODO.txt, todo.txt" )) return "\ue69c" ;
185
223
// TODO:
186
224
if (is_link ) return DEFAULT_LINK_FILE_ICON ;
187
225
return DEFAULT_FILE_ICON ;
0 commit comments