我有一个包含多个文件的源目录。其中一些是指向其他文件的符号链接。
我创建了一个cscope.files文件。但是当我执行cscope时。对于符号链接的文件,它会报错:
cscope: cannot find file /home/bla/source/file.cc我认为这不是很好,但也许正确的方法是更改"find“脚本,改为只编写symlink的目的地?
发布于 2015-04-08 23:49:26
目前我使用的是:
# Write only the files which are NOT symlinks
find `pwd` \( \( -iname "*.c" -o -iname "*.cc" -o -iname "*.h" \) -and \( -not -type l \) \) -print > cscope.files
# Add the target of the symlink for all files matching the right extension, and are symlinks
find `pwd` \( \( -iname "*.c" -o -iname "*.cc" -o -iname "*.h" \) -and -type l \) -printf "%l\n" >> cscope.files但这似乎是一个糟糕的解决方案。还在寻找一个更好的
发布于 2016-01-29 16:12:24
我认为您可以使用该命令来查找您搜索的文件夹中的所有真实路径
find -L [your searched folder] -name [your searched pattern] -exec realpath {} \; >> cscope.files例如,如果我想要将已开发的文件夹和linux内核头文件添加到cscope.files中,我将使用这些命令:
find -L `pwd` -iname "*.c" -o -iname "*.h" > cscope.files
find -L /usr/src/linux-headers-3.19.0-15-generic/ -iname '*.h' -exec realpath {} \; >> cscope.files我希望答案能对你有所帮助。
发布于 2017-01-13 21:39:34
例如,如果您希望将/作为cscope的路径,并希望cscope搜索扩展名为.c/.h/.x/.s/.S的文件,则可以将find命令指定为:
find / -type f -name "*.[chxsS]" -print -exec readlink -f {} \;> cscope.files这将包括常规文件,包括符号链接的目标。
https://stackoverflow.com/questions/29518681
复制相似问题