From 319a490c1f8b67ea0a99461d71d0cd4a5ebfbe36 Mon Sep 17 00:00:00 2001 From: lotherk Date: Sat, 14 Nov 2026 18:59:04 +0000 Subject: [PATCH] MCDE DtSvc: the type of a host-qualified name, so icons and Trash see the file (t0194) --- AGENTS.md | 11 +++++++++++ lib/DtSvc/DtUtil1/Dts.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index e3891af7..54fd0260 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -165,6 +165,17 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt kills the child (`mcdeChildPid`) and unlinks the half-written target. Measured: a 4 GB copy shows the window with "129.0 MB of 4295.0 MB" while the file is written. +- **Host-qualified names in the type database** (`lib/DtSvc/DtUtil1/Dts.c`, + `local_path()`): dtfile and the actions hand `host:/path` (the netfile + form) to `DtDtsFileToDataType`; the content criteria then opened + "host:/path" and every content-typed file was UNKNOWN -- a .txt showed the + "??" icon and Put in Trash refused it with "data attributes: UNKNOWN" + (measured 2026-11-14: the same file is TEXTFILE under its plain path and + UNKNOWN under `kitt:/path`; a directory is FOLDER vs UNKNOWN). When the + host part is this computer's name or `localhost`, the lookup now uses the + path without it. Measured after: TEXTFILE/FOLDER and the text, folder and + picture icons in dtfile. Trash still answers TT_ERR_NO_MATCH -- that is the + ToolTalk handler of t0206, not the type. - **The web browser** (t0179): the desktop has one action for a web page, `McdeWeb` (`programs/types/datatypes.dt.src`; `EXEC_STRING` runs `dtsystemsettings -open-web "%Arg_1%"`), and the choice of browser lives in diff --git a/lib/DtSvc/DtUtil1/Dts.c b/lib/DtSvc/DtUtil1/Dts.c index 5cb2c527..abd014f9 100644 --- a/lib/DtSvc/DtUtil1/Dts.c +++ b/lib/DtSvc/DtUtil1/Dts.c @@ -1453,10 +1453,38 @@ DtDtsDataToDataType(const char *fp, return(cleanup(0, info)); } +/* MCDE: dtfile and the actions hand a host-qualified name ("kitt:/path") + * to the type lookup; the content criteria then open "kitt:/path" and the + * type is UNKNOWN (measured 2026-11-14: a .txt in the shown folder is + * TEXTFILE under its plain path and UNKNOWN under the host-qualified one, so + * Put in Trash refused it). When the host is this computer, the name is + * used without its prefix. */ +static const char * +local_path(const char *filepath) +{ + static char host[256]; + const char *colon; + size_t n; + + if (filepath == NULL || (colon = strchr(filepath, ':')) == NULL || + colon[1] != '/') + return filepath; + n = (size_t) (colon - filepath); + if (n == 9 && strncmp(filepath, "localhost", 9) == 0) + return colon + 1; + if (host[0] == '\0' && gethostname(host, sizeof host) != 0) + host[0] = '\0'; + host[sizeof host - 1] = '\0'; + if (host[0] != '\0' && strlen(host) == n && + strncmp(filepath, host, n) == 0) + return colon + 1; + return filepath; +} + char * DtDtsFileToDataType(const char *filepath) { - char *dt = DtDtsDataToDataType(filepath, 0, -1, 0, 0, 0, 0); + char *dt = DtDtsDataToDataType(local_path(filepath), 0, -1, 0, 0, 0, 0); return(dt); }