首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >绝对路径与相对路径

绝对路径与相对路径
EN

Stack Overflow用户
提问于 2015-09-24 13:29:18
回答 1查看 3.9K关注 0票数 8

lcov如何决定何时使用绝对路径和相对路径?

我有一个app目录,其中包含产品的每个共享库的子目录和多个二进制文件的子目录。就像这样:

代码语言:javascript
复制
/home/user/app/libfoo/bar
/home/user/app/libfoo/baz
/home/user/app/libqux
/home/user/app/testsuite
/home/user/app/product

但是,当通过lcovgenhtml运行时,目录如下所示:

代码语言:javascript
复制
/home/user/app/libqux
/home/user/app/testsuite
/home/user/app/product
bar
baz

换句话说,我的一个共享库目录中的所有内容都使用一个相对路径,而其他所有内容都使用绝对路径。为什么?

我对lcovgenhtml的调用非常简单:

代码语言:javascript
复制
cd ~/app
testsuite/run_tests
lcov --capture --directory . --output-file coverage.info --gcov-tool gcov-5 --no-external
genhtml coverage.info --output-directory coverage
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-24 21:50:58

这是genhtml--prefix特性的结果。

代码语言:javascript
复制
   -p prefix
   --prefix prefix
          Remove prefix from all directory names.

          Because lists containing long filenames are difficult  to  read,
          there  is a mechanism implemented that will automatically try to
          shorten all directory names on the overview page beginning  with
          a  common  prefix.  By  default, this is done using an algorithm
          that tries to find the prefix which, when applied, will minimize
          the resulting sum of characters of all directory names.

          Use this option to specify the prefix to be removed by yourself.

在我的例子中,/home/user/app/libfoo库层次结构涉及到了足够多的genhtml,以至于genhtml决定通过剥离它来节省更多的字符,而不是更明显的剥除/home/user/app的方法。

传递一个显式的--prefix /home/user/app选项可以修复这个问题。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32762670

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档