docs: update resources API docs
This commit is contained in:
32
docs/api/resources/resourcepath/getdirectory.md
Normal file
32
docs/api/resources/resourcepath/getdirectory.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# ResourcePath::GetDirectory
|
||||
|
||||
```cpp
|
||||
Containers::String GetDirectory() const
|
||||
```
|
||||
|
||||
获取目录部分。
|
||||
|
||||
**详细描述:**
|
||||
|
||||
返回路径中最后一个路径分隔符之前的所有内容,即目录路径。兼容 Windows (`\`) 和 Unix (`/`) 路径分隔符。
|
||||
|
||||
**返回:** `Containers::String`,目录路径
|
||||
|
||||
**复杂度:** O(n),n 为路径长度
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
ResourcePath path("textures/player.png");
|
||||
Containers::String dir = path.GetDirectory(); // "textures"
|
||||
|
||||
ResourcePath path2("textures/subfolder/player.png");
|
||||
Containers::String dir2 = path2.GetDirectory(); // "textures/subfolder"
|
||||
|
||||
ResourcePath path3("player.png");
|
||||
Containers::String dir3 = path3.GetDirectory(); // ""
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [ResourcePath 总览](resourcepath.md) - 返回类总览
|
||||
Reference in New Issue
Block a user