the repository which powers this website
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index d28d9037..c6539ca0 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -7,7 +7,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
-
+#include "waow.h"
#include "cgit.h"
#include "ui-shared.h"
#include "cmd.h"
@@ -1368,3 +1368,17 @@ void cgit_set_title_from_path(const char *path)
strbuf_addf(&sb, " - %s", ctx.page.title);
ctx.page.title = strbuf_detach(&sb, NULL);
}
+
+
+const char *cgit_get_file_icon(const char *pathname, unsigned mode) {
+ if S_ISDIR (mode) return "folder";
+ int n = strlen(pathname);
+ const struct out *res = fname(pathname,n);
+ if (res) return res->value;
+ const char *ext = memchr(pathname, '.', n);
+ if (ext++) {
+ res = fext(ext, strlen(ext));
+ if (res) return res->value;
+ }
+ return "file";
+} \ No newline at end of file