=> 10d5a1ea2ded21623d1abcb6a955f5098faad334
[1mdiff --git a/src/app.c b/src/app.c[m [1mindex ba7d41d2..da6a343f 100644[m [1m--- a/src/app.c[m [1m+++ b/src/app.c[m [36m@@ -502,6 +502,8 @@[m [mconst iString *debugInfo_App(void) {[m iConstForEach(StringList, j, d->launchCommands) {[m appendFormat_String(msg, "%s\n", cstr_String(j.value));[m }[m [32m+[m[32m appendFormat_String(msg, "## MIME hooks\n");[m [32m+[m[32m append_String(msg, debugInfo_MimeHooks(d->mimehooks));[m return msg;[m }[m [m [36m@@ -1034,7 +1036,13 @@[m [miBool willUseProxy_App(const iRangecc scheme) {[m [m iBool handleCommand_App(const char *cmd) {[m iApp *d = &app_;[m [31m- if (equal_Command(cmd, "prefs.dialogtab")) {[m [32m+[m[32m if (equal_Command(cmd, "config.error")) {[m [32m+[m[32m makeMessage_Widget(uiTextCaution_ColorEscape "CONFIG ERROR",[m [32m+[m[32m format_CStr("Error in config file: %s\nSee \"about:debug\" for details.",[m [32m+[m[32m suffixPtr_Command(cmd, "where")));[m [32m+[m[32m return iTrue;[m [32m+[m[32m }[m [32m+[m[32m else if (equal_Command(cmd, "prefs.dialogtab")) {[m d->prefs.dialogTab = arg_Command(cmd);[m return iTrue;[m }[m [1mdiff --git a/src/mimehooks.c b/src/mimehooks.c[m [1mindex 8bb838ef..fd535643 100644[m [1m--- a/src/mimehooks.c[m [1m+++ b/src/mimehooks.c[m [36m@@ -1,6 +1,8 @@[m #include "mimehooks.h"[m [32m+[m[32m#include "app.h"[m [m #include[m [32m+[m[32m#include [m #include [m #include [m #include [m [36m@@ -23,6 +25,7 @@[m [mvoid deinit_FilterHook(iFilterHook *d) {[m [m void setMimePattern_FilterHook(iFilterHook *d, const iString *pattern) {[m iReleasePtr(&d->mimeRegex);[m [32m+[m[32m set_String(&d->mimePattern, pattern);[m d->mimeRegex = new_RegExp(cstr_String(pattern), caseInsensitive_RegExpOption);[m }[m [m [36m@@ -105,6 +108,7 @@[m [miBlock *tryFilter_MimeHooks(const iMimeHooks *d, const iString *mime, const iBlo[m static const char *mimeHooksFilename_MimeHooks_ = "mimehooks.txt";[m [m void load_MimeHooks(iMimeHooks *d, const char *saveDir) {[m [32m+[m[32m iBool reportError = iFalse;[m iFile *f = newCStr_File(concatPath_CStr(saveDir, mimeHooksFilename_MimeHooks_));[m if (open_File(f, read_FileMode | text_FileMode)) {[m iBlock * src = readAll_File(f);[m [36m@@ -124,6 +128,15 @@[m [mvoid load_MimeHooks(iMimeHooks *d, const char *saveDir) {[m setRange_String(&hook->label, lines[0]);[m setMimePattern_FilterHook(hook, collect_String(newRange_String(lines[1])));[m setCommand_FilterHook(hook, collect_String(newRange_String(lines[2])));[m [32m+[m[32m /* Check if commmand is valid. */ {[m [32m+[m[32m iRangecc seg = iNullRange;[m [32m+[m[32m while (nextSplit_Rangecc(range_String(&hook->command), ";", &seg)) {[m [32m+[m[32m if (!fileExistsCStr_FileInfo(cstr_Rangecc(seg))) {[m [32m+[m[32m reportError = iTrue;[m [32m+[m[32m }[m [32m+[m[32m break;[m [32m+[m[32m }[m [32m+[m[32m }[m pushBack_PtrArray(&d->filters, hook);[m pos = 0;[m }[m [36m@@ -131,9 +144,37 @@[m [mvoid load_MimeHooks(iMimeHooks *d, const char *saveDir) {[m delete_Block(src);[m }[m iRelease(f);[m [32m+[m[32m if (reportError) {[m [32m+[m[32m postCommand_App("~config.error where:mimehooks.txt");[m [32m+[m[32m }[m }[m [m void save_MimeHooks(const iMimeHooks *d) {[m iUnused(d);[m }[m [m [32m+[m[32mconst iString *debugInfo_MimeHooks(const iMimeHooks *d) {[m [32m+[m[32m iString *str = collectNew_String();[m [32m+[m[32m size_t index = 0;[m [32m+[m[32m iConstForEach(PtrArray, i, &d->filters) {[m [32m+[m[32m const iFilterHook *filter = i.ptr;[m [32m+[m[32m appendFormat_String(str, "### %d: %s\n", index, cstr_String(&filter->label));[m [32m+[m[32m appendFormat_String(str, "MIME regex:\n```\n%s\n```\n", cstr_String(&filter->mimePattern));[m [32m+[m[32m iStringList *args = iClob(split_String(&filter->command, ";"));[m [32m+[m[32m if (isEmpty_StringList(args)) {[m [32m+[m[32m appendFormat_String(str, "\u26a0 Command not specified!\n");[m [32m+[m[32m continue;[m [32m+[m[32m }[m [32m+[m[32m const iString *exec = constAt_StringList(args, 0);[m [32m+[m[32m if (isEmpty_String(exec)) {[m [32m+[m[32m appendFormat_String(str, "\u26a0 Command not specified!\n");[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m appendFormat_String(str, "Executable: %s\n```\n%s\n```\n",[m [32m+[m[32m fileExists_FileInfo(exec) ? "" : "\u26a0 FILE NOT FOUND",[m [32m+[m[32m cstr_String(exec));[m [32m+[m[32m }[m [32m+[m[32m index++;[m [32m+[m[32m }[m [32m+[m[32m return str;[m [32m+[m[32m}[m [1mdiff --git a/src/mimehooks.h b/src/mimehooks.h[m [1mindex c78a3c86..7a8cd2c9 100644[m [1m--- a/src/mimehooks.h[m [1m+++ b/src/mimehooks.h[m [36m@@ -29,3 +29,5 @@[m [miBlock * tryFilter_MimeHooks (const iMimeHooks *, const iString *mime,[m [m void load_MimeHooks (iMimeHooks *, const char *saveDir);[m void save_MimeHooks (const iMimeHooks *);[m [32m+[m [32m+[m[32mconst iString *debugInfo_MimeHooks (const iMimeHooks *);[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).