gpt4 book ai didi

windows - 当 PowerShell 脚本更新时,Doxygen 不读取 Doxyfile

转载 作者:可可西里 更新时间:2023-11-01 10:32:56 25 4
gpt4 key购买 nike

你好,Stackoverflow。

正如标题所说,我对 Doxygen 有疑问。

描述

PowerShell 脚本修改我的 Doxyfile 的 PROJECT_NUMBER 变量。

然后它运行 Doxygen,但它会生成 HTML 和 LaTeX 格式的文档,就像读取默认生成的 Doxyfile 一样。

如果我在 运行此脚本之前通过 Notepad++ 手动修改 Doxyfile,Doxygen 可以完美运行,但一旦运行脚本,问题就会出现。

我还要提到我的 Doxyfile 有:

  • GENERATE_HTML = 是
  • GENERATE_LATEX = 否
  • GENERATE_MAN = 是

在实践中,Doxygen 的行为是这样的:

.\doxygen.exe -g

\doxygen.exe .\Doxyfile

奇怪的行为现在开始了!

让我们调用我的实际 Doxyfile CustomConfig 和默认生成的 DefaultConfig

如果我通过 .\doxygen.exe -g 生成一个 DefaultConfig 然后我通过 Notepad++ 用 CustomConfig 的文本覆盖它的内容, doxygen 接受 Doxyfile,因为它应该,并生成正确的输出!

所以问题不在于 Doxyfile 内容,而在于修改文件的 PowerShell。

我已经通过对整个内容进行简单的复制和粘贴来验证这一点:

  • 通过 Notepad++ 复制和粘贴:WORK
  • 通过 PowerShell 复制和粘贴:行不通

PowerShell 脚本

# Replace the old PROJECT_NUMBER with the new one
$DOXY_PATH = $env:FS_OS + "\doc"
$CONFIG_PATH = $DOXY_PATH + "\bin\Doxyfile"
$BIN_PATH = $DOXY_PATH + "\bin\doxygen.exe"

$GIT_PATH = $env:FS_OS
$GIT_BRANCH = "Development"

# Get git commit number on the specified branch
$GIT_HASH = git log $GIT_BRANCH -1 --pretty=format:%H

$PRJ_CONTENT = Get-Content $CONFIG_PATH
$PRJ_NUM = "PROJECT_NUMBER = " + $GIT_HASH
$PRJ_CONTENT = $PRJ_CONTENT -replace "PROJECT_NUMBER\s*=\s*[A-z0-9]{40}",$PRJ_NUM
$PRJ_CONTENT | Out-File -FilePath $CONFIG_PATH

Start-Process -FilePath $BIN_PATH -ArgumentList "$CONFIG_PATH" -WorkingDirectory ($DOXY_PATH + "\bin")

复制粘贴脚本

$var = Get-Content "./doc/bin/Doxyfile.bak"
$var | Out-File -FilePath "./doc/bin/Doxyfile"

最佳答案

感谢@BenH 的评论,我找到了解决方案。

看起来 PowerShell 会使用 BOM 自动写入文件。

我从这个问题中找到了接受答案的解决方案:

Using PowerShell to write a file in UTF-8 without the BOM

关于windows - 当 PowerShell 脚本更新时,Doxygen 不读取 Doxyfile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43899556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com