[yunqa.de] Re: TDIWildFileFinder not matching wildcard patterns

  • From: Marek Jedlinski <marek@xxxxxxxxxxxx>
  • To: Marek Jedlinski <yunqa@xxxxxxxxxxxxx>
  • Date: Mon, 22 Dec 2008 04:35:03 +0100

Okay, I have found out the same problem in TDIPcreFileFinder, and then
realized they both match against the whole path, not just the filename.
So a*.txt is never found, but 'c:\mypath\a*.txt' is located correctly.

This feels strange, since the starting path is specified separately as the
SearchFolder property of the FileFinder component. Is there a way to
override this behavior? Or would you consider adding a flag to choose
between matching against the full path and matching only against the
current filename?

For example, what if I needed to locate files that match 'a*.txt' with
folder recursion? Since I don't know the subfolder names in advance, there
seems to be no way to specify a proper wildcard for this scenario.

(Delphi 2007, XP)

Thanks a lot again,
Marek


--
No ads, no nags freeware: http://www.tranglos.com
Skype: tranglos   GG: 5967086
alt. e-mail: marek.jedlinski(at)gmail.com



Marek Jedlinski (marek@xxxxxxxxxxxx):

> I may have found a problem with TDIWildFileFinder:

> When a simple wildcard pattern is specified such as '*.ext', the correct
> files are listed. However, when trying to use a more precise pattern,
> TDIWildFileFinder fails to locate any of the matching files.

> For example, these patterns fail to locate any files at all:

> abc.*
> a*.*
> a*.txt
> abc.txt (file is not found even when fully specified)

> In general, TDIWildFileFinder fails if any part of the filename portion is
> specified in the wildcard pattern. It works only if the filename portion is
> an asterisk. Indeed, if a file named 'abc.txt' exists, and the full filename 
> is
> specified exactly as the wildcard pattern, the file is not found.

> The same occurs when using the '?' wildcard in the filename portion: for
> the above example, only '*.???' works. However, '???.txt' fails to locate
> the file.

> The same problem occurs in the DIFileFinder_Main.dpr demo.

> Is this by design? I can use the RegEx variant as a quick substitute, but
> it's not always suitable for end users.

> Thank you, and very best regards,
> Marek



> --
> No ads, no nags freeware: http://www.tranglos.com
> Skype: tranglos   GG: 5967086
> alt. e-mail: marek.jedlinski(at)gmail.com


> _______________________________________________
> Delphi Inspiration mailing list
> yunqa@xxxxxxxxxxxxx
> //www.freelists.org/list/yunqa




_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: