Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use cscope with paths that contain spaces

Tags:

vim

cscope

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

Can i ask you for 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.

like image 874
julius Avatar asked Jul 07 '10 16:07

julius


3 Answers

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'
like image 64
Olivier Diotte Avatar answered Nov 15 '22 20:11

Olivier Diotte


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
like image 32
webb Avatar answered Nov 15 '22 19:11

webb


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.

like image 33
idbrii Avatar answered Nov 15 '22 19:11

idbrii