diff --git a/3rdparty/lolly/System/Classes/url.cpp b/3rdparty/lolly/System/Classes/url.cpp index a7ff069291e5f846a0db2e4b7c6d749878952d12..321529adb6779d7d411b5c89c7b313f9961fec27 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 0000000000000000000000000000000000000000..eb5bcb1565dbfc59808b9acf3fb478dcffadd637 --- /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)); +```