Skip to content
代码片段 群组 项目
提交 f261b201 编辑于 作者: Timotej Ecimovic's avatar Timotej Ecimovic
浏览文件

Support {name} and {basename} substitutions for auto-conversion, so SDK...

Support {name} and {basename} substitutions for auto-conversion, so SDK upgraders have an easier job.
上级 ffdf7d90
No related branches found
No related tags found
无相关合并请求
...@@ -104,15 +104,30 @@ function startNormal(uiEnabled, showUrl, zapFiles, options) { ...@@ -104,15 +104,30 @@ function startNormal(uiEnabled, showUrl, zapFiles, options) {
}) })
} }
/**
* Returns the output file out of input file and a pattern
*
* @param {*} inputFile
* @param {*} outputPattern
* @returns the path to the output file.
*/
function outputFile(inputFile, outputPattern) { function outputFile(inputFile, outputPattern) {
if (outputPattern.includes('{0}')) { let output = outputPattern
if (output.includes('{')) {
let dir = path.dirname(inputFile) let dir = path.dirname(inputFile)
let basename = path.basename(inputFile) let name = path.basename(inputFile)
let output = outputPattern.replace('{0}', basename) let basename
return path.join(dir, output) let i = name.indexOf('.')
} else { if (i == -1) {
return outputPattern basename = name
} else {
basename = name.substring(0, i)
}
output = output.replace('{name}', name)
output = output.replace('{basename}', basename)
output = path.join(dir, output)
} }
return output
} }
/** /**
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册