格式
typescript
File.GetParent(path)所属类: File
描述
获取指定路径的父文件夹名字。
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| path | string | 指定路径 |
返回值
| 类型 | 描述 |
|---|---|
string | 父文件夹名字 |
代码示例
javascript
function Test() {
try {
const file_path: string = "D:/TestingResources/test.txt"
let parent_path = File.GetParent(file_path);
Debug.log(parent_path); // D:/TestingResources
} catch (error) {
Debug.Error(error);
}
}