feat(stdlib): Mid M2 path algebra and fs copy/move/temp
Add lib/path (EN/ZH) and thicken fs with sandboxed copy_file, move, and make_temp, with golds and public demos. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
838a2b425a
commit
94ae6713aa
22 files changed
+618
-25
No files matched your search
@@ -40,6 +40,29 @@ description: English filesystem wrappers
|
||||
|
||||
**> host_remove path=`path`**
|
||||
|
||||
## copy_file
|
||||
+ `src`
|
||||
+ `dest`
|
||||
|
||||
Copy a file (overwrites `dest` if it exists). Paths are sandboxed like other fs ops.
|
||||
|
||||
**> host_copy_file src=`src` dest=`dest`**
|
||||
|
||||
## move
|
||||
+ `src`
|
||||
+ `dest`
|
||||
|
||||
Rename / move within the sandbox.
|
||||
|
||||
**> host_move src=`src` dest=`dest`**
|
||||
|
||||
## make_temp
|
||||
+ `prefix`=None
|
||||
|
||||
Create an empty temp file under the program directory; return its relative path.
|
||||
|
||||
**> host_make_temp prefix=`prefix`**
|
||||
|
||||
## text_patch
|
||||
+ `path`
|
||||
+ `find`
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: lib/path
|
||||
description: Path algebra (Mid M2). No I/O; OS separators.
|
||||
---
|
||||
|
||||
## join
|
||||
+ `a`
|
||||
+ `b`
|
||||
|
||||
**> host_path_join a=`a` b=`b`**
|
||||
|
||||
## split
|
||||
+ `path`
|
||||
|
||||
**> host_path_split path=`path`**
|
||||
|
||||
## file_name
|
||||
+ `path`
|
||||
|
||||
**> host_path_file_name path=`path`**
|
||||
|
||||
## parent
|
||||
+ `path`
|
||||
|
||||
**> host_path_parent path=`path`**
|
||||
|
||||
## extension
|
||||
+ `path`
|
||||
|
||||
**> host_path_extension path=`path`**
|
||||
|
||||
## normalize
|
||||
+ `path`
|
||||
|
||||
**> host_path_normalize path=`path`**
|
||||
|
||||
## is_absolute
|
||||
+ `path`
|
||||
|
||||
**> host_path_is_absolute path=`path`**
|
||||
@@ -40,6 +40,29 @@ description: 中文文件系统包装
|
||||
|
||||
**> host_remove path=`路径`**
|
||||
|
||||
## 复制文件
|
||||
+ `源`
|
||||
+ `目标`
|
||||
|
||||
复制文件(目标已存在则覆盖)。路径沙箱同其他文件操作。
|
||||
|
||||
**> host_copy_file src=`源` dest=`目标`**
|
||||
|
||||
## 移动
|
||||
+ `源`
|
||||
+ `目标`
|
||||
|
||||
在沙箱内重命名 / 移动。
|
||||
|
||||
**> host_move src=`源` dest=`目标`**
|
||||
|
||||
## 建临时
|
||||
+ `前缀`=None
|
||||
|
||||
在程序目录下创建空临时文件,返回相对路径。
|
||||
|
||||
**> host_make_temp prefix=`前缀`**
|
||||
|
||||
## 文本补丁
|
||||
+ `路径`
|
||||
+ `查找`
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: lib/路径
|
||||
description: 路径代数(中层 M2)。无 I/O;分隔符随宿主 OS。
|
||||
---
|
||||
|
||||
## 拼接
|
||||
+ `甲`
|
||||
+ `乙`
|
||||
|
||||
**> host_path_join a=`甲` b=`乙`**
|
||||
|
||||
## 拆分
|
||||
+ `路径`
|
||||
|
||||
**> host_path_split path=`路径`**
|
||||
|
||||
## 文件名
|
||||
+ `路径`
|
||||
|
||||
**> host_path_file_name path=`路径`**
|
||||
|
||||
## 父目录
|
||||
+ `路径`
|
||||
|
||||
**> host_path_parent path=`路径`**
|
||||
|
||||
## 扩展名
|
||||
+ `路径`
|
||||
|
||||
**> host_path_extension path=`路径`**
|
||||
|
||||
## 规范化
|
||||
+ `路径`
|
||||
|
||||
**> host_path_normalize path=`路径`**
|
||||
|
||||
## 是绝对
|
||||
+ `路径`
|
||||
|
||||
**> host_path_is_absolute path=`路径`**
|
||||
Reference in new issue
Block a user