修复inno setup中脚本的版本修改失败问题。
This commit is contained in:
@@ -30,9 +30,7 @@ static const UINT DEFAULT_MINOR_WHEN_NO_TAG_FOR_SETUP = 0;
|
||||
/// 在字符串内容中查找首个包含 strToken 的整行,
|
||||
/// 用 strNewLine 替换该行(不含行尾换行符)。
|
||||
/// </summary>
|
||||
static BOOL ReplaceLineByToken(std::string& strContent,
|
||||
const std::string& strToken,
|
||||
const std::string& strNewLine)
|
||||
static BOOL ReplaceLineByToken(std::string& strContent, const std::string& strToken, const std::string& strNewLine)
|
||||
{
|
||||
std::string::size_type nPos = strContent.find(strToken);
|
||||
if (nPos == std::string::npos)
|
||||
@@ -119,17 +117,17 @@ static BOOL ModifyIssScript(const CString& strScriptPath, const CString& strFile
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const std::string strToken = "#define MyAppVersion ";
|
||||
const std::string strToken = "#define MyAppVersion ";
|
||||
if (strContent.find(strToken) == std::string::npos)
|
||||
{
|
||||
_tprintf(_T("错误: .iss 文件中未找到 #define MyAppVersion 行: %s\n"), strScriptPath.GetString());
|
||||
_tprintf(_T("错误: .iss 文件中未找到 #define MyAppVersion 行: %s\n"), strScriptPath.GetString());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::string strNewLine = "#define MyAppVersion \"" + ToAnsiString(strFileVersion.GetString()) + "\"";
|
||||
std::string strNewLine = "#define MyAppVersion \"" + ToAnsiString(strFileVersion.GetString()) + "\"";
|
||||
if (!ReplaceLineByToken(strContent, strToken, strNewLine))
|
||||
{
|
||||
_tprintf(_T("错误: 替换 .iss #define MyAppVersion 行失败。\n"));
|
||||
_tprintf(_T("错误: 替换 .iss #define MyAppVersion 行失败。\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -139,7 +137,7 @@ static BOOL ModifyIssScript(const CString& strScriptPath, const CString& strFile
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_tprintf(_T("成功: 已更新 .iss #define MyAppVersion \"%s\"\n"), strFileVersion.GetString());
|
||||
_tprintf(_T("成功: 已更新 .iss #define MyAppVersion \"%s\"\n"), strFileVersion.GetString());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user