Author Topic: 'Find 'n Replace TB' exclusion of (sub-)dirs problem ?  (Read 4455 times)

hs2

  • Senior Community Member
  • Posts: 2743
  • Hero Points: 288
'Find 'n Replace TB' exclusion of (sub-)dirs problem ?
« on: August 13, 2007, 04:21:45 pm »
@SlickTeam:
I had some problems to get the exclusion of sub-dirs right when doing a 'Find in Files'.
Help tells that e.g. this pattern '*\CVS\' could be used but that's not working. I'd to use '\\sub_dir\\*' instead.
However, I made a small change in tbfind.e which helps me a bit.
tbfind.e - _get_files_list() [line 3577]: (v12.02)
Code: [Select]
   // HS2-ADD: if last char is a FILESEP a sub-dir exclusion is guessed
   if ( last_char( exclude ) == FILESEP ) strappend( exclude, '*' );
#if !__UNIX__  // HS2-ADD: needed for proper sub-dir exclusion on Windows
   exclude = stranslate(exclude, FILESEP:+FILESEP, FILESEP);
#endif

As a sideeffect the exclusion filespec now follows the same (smart) notation as used by DIFFZilla (e.g. 'CVS\' resp. 'CVS/' would work).
Maybe I miss sth. else but this seems to be a nice improvement...

HS2
« Last Edit: August 13, 2007, 04:28:28 pm by hs2 »

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: 'Find 'n Replace TB' exclusion of (sub-)dirs problem ?
« Reply #1 on: August 13, 2007, 06:19:43 pm »
Exactly what problems are you having configuring the exclude patterns?  I'm not sure what you are intending to fix with your change.

hs2

  • Senior Community Member
  • Posts: 2743
  • Hero Points: 288
Re: 'Find 'n Replace TB' exclusion of (sub-)dirs problem ?
« Reply #2 on: August 13, 2007, 06:53:43 pm »
3 use cases using orig. version of tbfind.e:
1.) this exclusion seems anyway wrong but it's described in the help ('*\CVS\')
Find all "pthread_join", "<Workspace>", "*.c;*.cc;*.cpp;*.cp;*.cxx;*.h;*.hh;*.hpp;*.hxx;*.inl;*.def;*.mak;Makefile;*.rc;*.s;*.S;*.cmd;*.btm", Exclude: "*\xilkernel_v3_00_a\"
No files were found to look in.

2.)
Find all "pthread_join", "<Workspace>", "*.c;*.cc;*.cpp;*.cp;*.cxx;*.h;*.hh;*.hpp;*.hxx;*.inl;*.def;*.mak;Makefile;*.rc;*.s;*.S;*.cmd;*.btm", Exclude: "\xilkernel_v3_00_a\*"
No files were found to look in.

3.) Exclusion has no effect - too much hits
Find all "pthread_join", "<Workspace>", "*.c;*.cc;*.cpp;*.cp;*.cxx;*.h;*.hh;*.hpp;*.hxx;*.inl;*.def;*.mak;Makefile;*.rc;*.s;*.S;*.cmd;*.btm", Exclude: "xilkernel_v3_00_a\"

With my change these exclusions work:
"\xilkernel_v3_00_a\*"
"xilkernel_v3_00_a\"
or of course:
"/xilkernel_v3_00_a/*"
"xilkernel_v3_00_a/"

HS2

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: 'Find 'n Replace TB' exclusion of (sub-)dirs problem ?
« Reply #3 on: August 13, 2007, 07:52:15 pm »
Thanks for the info, I see what the problem is now.  The key part I was missing was using the <Workspace> or <Project> searches with an exclude path.  There are different code paths in generating the file list for Workspace/Project tree vs. a file directory, and the exclude wildcard is not exactly being applied the same way in both of the code paths.  I will generate a fix for this, hopefully in time for 12.0.3.  Thanks for the heads up.

hs2

  • Senior Community Member
  • Posts: 2743
  • Hero Points: 288
Re: 'Find 'n Replace TB' exclusion of (sub-)dirs problem ?
« Reply #4 on: August 13, 2007, 08:06:45 pm »
Good news ! I'd appreciate if the exclude pattern handling (at least conc. subdirs) will be the same as it's done by DIFFZilla so that I don't need to think about diff. styles of excluding sth.
Good luck trying to push it into v12.03 ! ( OTOH - I'm quite happy with my patch ;) )
Thanks, HS2