Skip to content

Commit 574e508

Browse files
authored
docs: fix path concatenation error in storage.md (#7448)
* docs: 修复 storage.md 中路径拼接的错误示例 get_astrbot_data_path() 返回的是 str 类型,直接使用 / 运算符会导致 TypeError。修改文档示例,添加 Path() 包裹 * docs: 修复 storage.md 中路径拼接的错误示例 get_astrbot_data_path() 返回的是 str 类型,直接使用 / 运算符会导致 TypeError。修改文档示例,添加 Path() 包裹。
1 parent 16f57dd commit 574e508

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

docs/en/dev/star/guides/storage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ To keep large file handling consistent, store large files under `data/plugin_dat
2525
You can fetch the plugin data directory with:
2626

2727
```py
28+
from pathlib import Path
2829
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
2930

30-
plugin_data_path = get_astrbot_data_path() / "plugin_data" / self.name # self.name is the plugin name; available in v4.9.2 and above. For lower versions, specify the plugin name yourself.
31+
plugin_data_path = Path(get_astrbot_data_path()) / "plugin_data" / self.name # self.name is the plugin name; available in v4.9.2 and above. For lower versions, specify the plugin name yourself.
3132
```

docs/zh/dev/star/guides/storage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class Main(star.Star):
2525
你可以通过以下代码获取插件数据目录:
2626

2727
```py
28+
from pathlib import Path
2829
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
2930

30-
plugin_data_path = get_astrbot_data_path() / "plugin_data" / self.name # self.name 为插件名称,在 v4.9.2 及以上版本可用,低于此版本请自行指定插件名称
31+
plugin_data_path = Path(get_astrbot_data_path()) / "plugin_data" / self.name # self.name 为插件名称,在 v4.9.2 及以上版本可用,低于此版本请自行指定插件名称
3132
```

0 commit comments

Comments
 (0)