From e483dfd354a9fd653b4a152f509ea117d09c4d08 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Mon, 18 Aug 2025 16:53:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=20lolly=20=E7=9A=84=20glue=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=AF=B9=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=9A=84=E5=A4=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdparty/lolly/System/Classes/url.cpp | 1 + devel/211_2.md | 32 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 devel/211_2.md diff --git a/3rdparty/lolly/System/Classes/url.cpp b/3rdparty/lolly/System/Classes/url.cpp index a7ff06929..321529adb 100644 --- a/3rdparty/lolly/System/Classes/url.cpp +++ b/3rdparty/lolly/System/Classes/url.cpp @@ -461,6 +461,7 @@ glue (url u, string s) { if (is_concat (u)) return u[1] * glue (u[2], s); if (is_or (u)) return glue (u[1], s) | glue (u[2], s); if (is_none (u)) return u; + if (is_root (u)) return as_url (url_tree (u[1]->t->label * s)); TM_FAILED ("can't glue string to url"); return u; } diff --git a/devel/211_2.md b/devel/211_2.md new file mode 100644 index 000000000..eb5bcb156 --- /dev/null +++ b/devel/211_2.md @@ -0,0 +1,32 @@ +# 211_2 +## 如何测试 +### 测试在 lolly 的 glue 函数中添加对根目录的处理 +1. cmd-o 打开文件 +2. 选择根目录(Mactonish HD) +3. 打开 +4. 检查:STEM 没有 Crash,弹窗显示"The file cannot be created or loaded /" + +## 在 lolly 的 glue 函数中添加对根目录的处理 +### Why? +在此 Issue 中,macOS平台因为打开了根目录而导致crash:macOS上打开根目录导致Crash +https://gitee.com/XmacsLabs/mogan/issues/ICPW34 + +崩溃的具体原因是,在调用 lolly 的 glue 函数时,lolly 的条件并没有覆盖到根目录的情况,导致报出 TM_FAILED + +``` +url +glue (url u, string s) { + if (is_atomic (u)) return as_url (url_tree (u->t->label * s)); + if (is_concat (u)) return u[1] * glue (u[2], s); + if (is_or (u)) return glue (u[1], s) | glue (u[2], s); + if (is_none (u)) return u; + TM_FAILED ("can't glue string to url"); + return u; +} +``` + +### How? +添加特殊处理根目录的分支 +``` + if (is_root (u)) return as_url (url_tree (u[1]->t->label * s)); +``` -- Gitee