基础功能资产管理Path本页总览Path 描述: 进行系统文件路径操作的类。 getScriptPath 类型: 函数。 描述: 从脚本模块名称中获得脚本的文件路径。 签名: getScriptPath: function(self: Path, moduleName: string): string 用法示例: -- 在名字叫'init'的项目脚本程序入口文件中local scriptPath = Path:getScriptPath(...)-- 设置项目文件搜索路径Content:insertSearchPath(1, scriptPath) 参数: 参数名类型描述moduleNamestring脚本模块的名称。 返回值: 返回类型描述string脚本模块的路径。 getExt 类型: 函数。 描述: 输入: /a/b/c.TXT 输出: txt 签名: getExt: function(self: Path, path: string): string 参数: 参数名类型描述pathstring要处理的文件路径。 返回值: 返回类型描述string文件扩展名。 getPath 类型: 函数。 描述: 输入: /a/b/c.TXT 输出: /a/b 签名: getPath: function(self: Path, path: string): string 参数: 参数名类型描述pathstring要处理的文件路径。 返回值: 返回类型描述string获得的父级文件路径。 getName 类型: 函数。 描述: 输入: /a/b/c.TXT 输出: c 签名: getName: function(self: Path, path: string): string 参数: 参数名类型描述pathstring要处理的文件路径。 返回值: 返回类型描述string不包含扩展名的文件名。 getFilename 类型: 函数。 描述: 输入: /a/b/c.TXT 输出: c.TXT 签名: getFilename: function(self: Path, path: string): string 参数: 参数名类型描述pathstring要处理的文件路径。 返回值: 返回类型描述string文件名。 getRelative 类型: 函数。 描述: 输入: /a/b/c.TXT, /a 输出: b/c.TXT 签名: getRelative: function(self: Path, path: string, base: string): string 参数: 参数名类型描述pathstring要处理的文件路径。basestring要取得相对路径的基础文件路径。 返回值: 返回类型描述string相对文件路径。 replaceExt 类型: 函数。 描述: 输入: /a/b/c.TXT, lua 输出: /a/b/c.lua 签名: replaceExt: function(self: Path, path: string, newExt: string): string 参数: 参数名类型描述pathstring要处理的文件路径。newExtstring要替换的新文件扩展名。 返回值: 返回类型描述string处理后的文件路径。 replaceFilename 类型: 函数。 描述: 输入: /a/b/c.TXT, d 输出: /a/b/d.TXT 签名: replaceFilename: function(self: Path, path: string, newFile: string): string 参数: 参数名类型描述pathstring要处理的文件路径。newFilestring要替换的新文件名。 返回值: 返回类型描述string处理后的文件路径。 __call 类型: 元方法。 描述: 输入: a, b, c.TXT 输出: a/b/c.TXT 签名: metamethod __call: function(self: Path, ...: string): string 参数: 参数名类型描述...string要拼接成新文件路径的文件名分段。 返回值: 返回类型描述string新的文件路径。