Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

If using file ext. specifiers,won't scan tree

Help
TCB
2008-03-25
2013-05-29
  • TCB
    TCB
    2008-03-25

    Darren,
    Thanks for your contribution to the open source community.

    I am trying to recurse a directory tree and have been successful.
    However, when I provide file-scope specifiers (*.cpp & *.h) it does not
    work. It seems that it should.

    My project directory structure is:

    C:\SftDev\GameraHardwareRev3\Controller
        *.h
        *.c
        \Common (There are no source files directly in common)
            \There are 12 folder underneath common. Each has Cpp & H and possibly C or asm files.
        \Lite (has asm, CPP & H files)
            \Build (has asm, CPP & H files)

    Regards,
    JC (test results below)

    ===========================================================================
    Here are the results of my testing.

    I opened a command prompt and navigated to the C:\SftDev\GameraHardwareRev3\Controller directory.

    ===========================================================================
    "C:\Program Files\Boxer Text Editor\Ctags\Ctags" -R -o JimTag.txt *.cpp *.h

    -- The above line produces a file with 171 lines\entries

    ===========================================================================
    "C:\Program Files\Boxer Text Editor\Ctags\Ctags" -R -o JimTag.txt -L scope.txt

    -- The above line produced the errors:
      -- Ctags: Warning: cannot open source file "C:\SftDev\GameraHardwareRev3\Controller\*.cpp" : No such file or directory
      -- Ctags: Warning: cannot open source file "C:\SftDev\GameraHardwareRev3\Controller\*.h : No such file or directory
        -- NOTE: scope.txt contains 2 lines:
             -- C:\SftDev\GameraHardwareRev3\Controller\*.cpp
             -- C:\SftDev\GameraHardwareRev3\Controller\*.h

    ===========================================================================
    "C:\Program Files\Boxer Text Editor\Ctags\Ctags" -fields=fKSzsn - recurse=yes -o JimTag.txt

    -- The above line produces a file with 51414 lines\entries

    ===========================================================================
    "C:\Program Files\Boxer Text Editor\Ctags\Ctags" -fields=fKSzsn - recurse=yes -o JimTag.txt *.cpp *.h

    -- The above line produces a file with 171 lines\entries

    ===========================================================================
    From the CTags online manual:

    OPTIONS
    Despite the wealth of available options, defaults are set so that ctags
    is most commonly executed without any options (e.g. "ctags *", or
    "ctags -R"), which will create a tag file in the current directory for
    all recognized source files. The options described below are provided
    merely to allow custom tailoring to meet special needs.

    ===========================================================================
    From the blog at:
    http://hoangtran.wordpress.com/2007/11/09/c-development-using-vim-and-ctags/

    If all of your source code is in one directory tree then simply run the following command:
    ctags --recurse --language-force=c++ --extra=+q --fields=+i *.cpp *.h

    From my examples above, this does not seem to work. It seems to me that
    the *.cpp and *.h file specifiers seem to confuse Ctags when trying to
    setup and automatically recursed tree.