From 2a9ea1567d6a694584093fca5322a6d3e34b565f Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Wed, 7 Jul 2021 17:14:05 +0900 Subject: [PATCH] file-browser: Recognize more file types by extension --- apps/file-browser.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/apps/file-browser.c b/apps/file-browser.c index 238f6de9..b06dc9a9 100644 --- a/apps/file-browser.c +++ b/apps/file-browser.c @@ -648,8 +648,7 @@ static void load_directory(const char * path, int modifies_history) { sprintf(f->filetype, "Portable Network Graphics Image"); } else if (has_extension(f, ".sdf")) { sprintf(f->icon, "font"); - sprintf(f->filetype, "SDF Font"); - /* TODO: Font viewer for SDF and TrueType */ + sprintf(f->filetype, "Legacy SDF Font"); } else if (has_extension(f, ".ttf")) { sprintf(f->icon, "font"); sprintf(f->launcher,"exec font-preview"); @@ -657,6 +656,7 @@ static void load_directory(const char * path, int modifies_history) { } else if (has_extension(f, ".tgz") || has_extension(f, ".tar.gz")) { sprintf(f->icon, "package_targz"); sprintf(f->filetype, "Compressed Archive File"); + /* TODO: Archive viewer */ } else if (has_extension(f, ".tar")) { sprintf(f->icon, "package_tar"); sprintf(f->filetype, "Archive File"); @@ -708,6 +708,31 @@ static void load_directory(const char * path, int modifies_history) { } else if (has_extension(f, ".ld")) { sprintf(f->icon, "file"); sprintf(f->filetype, "Linker Script"); + } else if (has_extension(f, ".md")) { + sprintf(f->icon, "file"); + sprintf(f->filetype, "Markdown Text Document"); + } else if (has_extension(f, ".eshrc")) { + sprintf(f->icon, "sh"); + sprintf(f->filetype, "Shell Configuration"); + } else if (has_extension(f, ".bim3rc")) { + sprintf(f->icon, "krk"); + sprintf(f->filetype, "Bim Configuration"); + } else if (has_extension(f, ".biminfo")) { + sprintf(f->icon, "file"); + sprintf(f->filetype, "Bim Status Cache"); + } else if (has_extension(f, ".conf")) { + sprintf(f->icon, "file"); + sprintf(f->filetype, "Configuration File"); + } else if (has_extension(f, ".launcher")) { + sprintf(f->icon, "file"); + sprintf(f->filetype, "Application Launcher"); + } else if (has_extension(f, ".trt")) { + sprintf(f->icon, "file"); + sprintf(f->filetype, "Toaru Rich Text Document"); + sprintf(f->launcher, "exec help-browser"); + } else if (has_extension(f, ".json")) { + sprintf(f->icon, "file"); + sprintf(f->filetype, "JavaScript Object Notation File"); } else if (statbuf.st_mode & 0111) { /* Executable files - use their name for their icon, and launch themselves. */ sprintf(f->icon, "%s", f->name);