[fpc-pascal] Finding long file names
Michael Van Canneyt
michael at freepascal.org
Thu Oct 5 09:33:16 CEST 2017
On Wed, 4 Oct 2017, James Richters wrote:
> I'm trying to use findfirst()/findnext to obtain a list of files. Here's my code:
> If FindFirst(Searchfile, FAAnyfile-FAHidden, FileDirInfo)=0 then
> It finds most files, even ones with really long file names, however it can't find files with periods in the file name,
> So it will find:
> This is a TEST.Tap
> But it will not find:
> If I change my search string to:
> Then it DOES find the files with more than one period in them... along with everything else.
> I could filter them out myself I suppose, but that seems to defeat the way findfirst is supposed to work.
> Any ideas how to make this work? Is there a better method to use than findfirst() ?
> I notice that if I use Extractfileext() with This.is.a.TEST.tap it correctly returns '.tap' as the extension. Maybe findfirst is an obsolete way of listing the files? Or maybe it just never got fixed to handle valid files with more than one period?
Findfirst is definitely the way.
If this is on windows, then you've probably found a bug in findfirst/findnext.
Strange that this would go unnoticed for so long.
More information about the fpc-pascal