是否可以将 Doxygen 过滤器命令用引号引起来?
Is it possible to wrap a Doxygen filter command in quotes?
我正在尝试编写一个 Doxygen 文件过滤器,该过滤器位于 Windows 和 Linux 上的 Doxyfile 子目录中。
Doxyfile
/scripts
myfilter
我似乎无法在 Windows 上使用正斜杠指定路径,除非它被引用:
"scripts/myfilter"
但是,尝试引用 Doxyfile 中的命令不起作用。
FILTER_PATTERNS = *.glsl=""scripts/runpython" scripts/doxygen-glslfilter.py"
在 Windows 上,您收到一条错误消息,提示引号不存在。
'scripts' is not recognized as an internal or external command, operable program or batch file.
Doxygen 使用 popen() 来 运行 这些命令并将删除命令周围的环绕引号,但它似乎并没有删除所有引号。
popen() 调用:
https://github.com/doxygen/doxygen/blob/master/src/definition.cpp#L745
过滤器名称引用条:
https://github.com/doxygen/doxygen/blob/master/src/util.cpp#L2458
但是,结果与没有引号一样。
更新
我能够在 Doxygen 中获取命令日志记录,但似乎多余的引号以一种奇怪的方式被删除了。可以看到怎么命令前面多了个space
Executing popen(` scripts/runpython scripts/doxygen-glslfilter.py "C:/dev/g3d/G3D10/data-files/shader/AlphaFilter.glsl"`)
更新
我提交了一个错误 report/feature 请求,但我怀疑它是否会被阅读。
当在单个字符串中使用双引号内的双引号时,它会将第一个双引号视为开始字符串,将下一个双引号视为字符串的结尾。
所以在你的例子中:
""scripts/runpython" scripts/doxygen-glslfilter.py"
前 2 个引号被视为打开和关闭,然后它将 scripts/runpython
视为下一个命令等。
我没有相同的工具,但是这 2 个示例可能会解决您的问题。
此示例将每个集合用双引号引起来,将整个集合用单引号引起来。
FILTER_PATTERNS = *.glsl='"scripts/runpython" "scripts/doxygen-glslfilter.py"'
此示例将第一个集合用双引号引起来,将整个集合用单引号引起来。
FILTER_PATTERNS = *.glsl='"scripts/runpython" scripts/doxygen-glslfilter.py'
注意!! 我无法测试这个,因为我没有和你一样的环境。因此,我不确定第二个选项是否有效,因为它可能还需要 scripts/doxygen-glslfilter.py
双引号,无论如何我都会将其添加到答案中。
该问题已报告给 doxygen 项目,他们提供了一个解决方案,其中命令中的任何“/”都替换为 Windows 上的“\”。
https://bugzilla.gnome.org/show_bug.cgi?id=792846
这样做是为了解决此处的类似问题:
github 上项目的拉取请求:https://github.com/doxygen/doxygen/pull/703
我正在尝试编写一个 Doxygen 文件过滤器,该过滤器位于 Windows 和 Linux 上的 Doxyfile 子目录中。
Doxyfile
/scripts
myfilter
我似乎无法在 Windows 上使用正斜杠指定路径,除非它被引用:
"scripts/myfilter"
但是,尝试引用 Doxyfile 中的命令不起作用。
FILTER_PATTERNS = *.glsl=""scripts/runpython" scripts/doxygen-glslfilter.py"
在 Windows 上,您收到一条错误消息,提示引号不存在。
'scripts' is not recognized as an internal or external command, operable program or batch file.
Doxygen 使用 popen() 来 运行 这些命令并将删除命令周围的环绕引号,但它似乎并没有删除所有引号。
popen() 调用:
https://github.com/doxygen/doxygen/blob/master/src/definition.cpp#L745
过滤器名称引用条:
https://github.com/doxygen/doxygen/blob/master/src/util.cpp#L2458
但是,结果与没有引号一样。
更新
我能够在 Doxygen 中获取命令日志记录,但似乎多余的引号以一种奇怪的方式被删除了。可以看到怎么命令前面多了个space
Executing popen(` scripts/runpython scripts/doxygen-glslfilter.py "C:/dev/g3d/G3D10/data-files/shader/AlphaFilter.glsl"`)
更新
我提交了一个错误 report/feature 请求,但我怀疑它是否会被阅读。
当在单个字符串中使用双引号内的双引号时,它会将第一个双引号视为开始字符串,将下一个双引号视为字符串的结尾。 所以在你的例子中:
""scripts/runpython" scripts/doxygen-glslfilter.py"
前 2 个引号被视为打开和关闭,然后它将 scripts/runpython
视为下一个命令等。
我没有相同的工具,但是这 2 个示例可能会解决您的问题。
此示例将每个集合用双引号引起来,将整个集合用单引号引起来。
FILTER_PATTERNS = *.glsl='"scripts/runpython" "scripts/doxygen-glslfilter.py"'
此示例将第一个集合用双引号引起来,将整个集合用单引号引起来。
FILTER_PATTERNS = *.glsl='"scripts/runpython" scripts/doxygen-glslfilter.py'
注意!! 我无法测试这个,因为我没有和你一样的环境。因此,我不确定第二个选项是否有效,因为它可能还需要 scripts/doxygen-glslfilter.py
双引号,无论如何我都会将其添加到答案中。
该问题已报告给 doxygen 项目,他们提供了一个解决方案,其中命令中的任何“/”都替换为 Windows 上的“\”。
https://bugzilla.gnome.org/show_bug.cgi?id=792846
这样做是为了解决此处的类似问题:
github 上项目的拉取请求:https://github.com/doxygen/doxygen/pull/703