优化ActionCommand中的文件路径处理逻辑,新增PackageProtocol以解析@package://前缀的路径,提升路径解析的准确性和灵活性。
This commit is contained in:
@ -105,7 +105,10 @@ ${COMMANDS.HELLO}
|
||||
// 处理文件路径,将@package://和@project://前缀替换为实际路径
|
||||
let filePath = roleInfo.file
|
||||
if (filePath.startsWith('@package://')) {
|
||||
filePath = filePath.replace('@package://', '')
|
||||
const PackageProtocol = require('../../resource/protocols/PackageProtocol')
|
||||
const packageProtocol = new PackageProtocol()
|
||||
const relativePath = filePath.replace('@package://', '')
|
||||
filePath = await packageProtocol.resolvePath(relativePath)
|
||||
} else if (filePath.startsWith('@project://')) {
|
||||
// 对于@project://路径,使用当前工作目录作为基础路径
|
||||
const ProjectProtocol = require('../../resource/protocols/ProjectProtocol')
|
||||
|
||||
Reference in New Issue
Block a user