开发者

How to use cscope with paths that contain spaces

开发者 https://www.devze.com 2023-01-06 05:00 出处:网络
There are some folder that contains space, and as a result, those folders can not be indexed using cscope.

There are some folder that contains space, and as a result, those folders can not be indexed using cscope.

Can i ask you fo开发者_如何学JAVAr help to solve this,or any suggestion.

thanks Julius


Thanks for your reply.

My steps to use cscope like the following

  • find . -name '*.scala'>cscope.files
  • cscope -b

    at this step. i see the message indicates that can not find file:

    cscope: cannot find file /work/project/copy

    cscope: cannot find file of

    cscope: cannot find file fp/src/main/jav....

    Actually copy of fp is a folder.so i think cscope can not recognize the folder contains space.

I encountered this problem when i tried to use vim with cscope.maybe i need move this question to other tag.


You can do it simply using GNU find at least, you can use the -printf or -fprintf options for that:

find . -type f -fprintf cscope.files '"%p"\n'


pydave's answer is very slow. This way took 0.10s where pydave's answer took 14s:

find . -name "*.scala" | awk '{print "\""$0"\""}' > cscope.files


You can use find's -exec to force quotes around your output:

find . -name "*.scala" -exec echo \"{}\" \; > cscope.files

You might need to mess around with quoting/escaping if you're doing this from a script.


Double quoting the files names works in cygwin, where as escaping with backslash does not.

$ find $PWD -name "*.scala" | sed -e 's/^/"/g' -e 's/$/"/g' > cscope.files
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号