[fpc-pascal] Finding long file names

Sven Barth pascaldragon at googlemail.com
Thu Oct 5 11:50:18 CEST 2017

Am 05.10.2017 01:49 schrieb "James Richters" <james at productionautomation.net
> I'm trying to use findfirst()/findnext to obtain a list of files.  Here's
my code:
> Searchfile:=Tap_Drive+Tap_Path+'\'+Tap_SubDirectory+'\*.TAP';
> 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:
> This.is.a.TEST.tap
> If I change my search string to:
> Searchfile:=Tap_Drive+Tap_Path+'\'+Tap_SubDirectory+'\*.*';
> 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?
> Any thoughts on this?

I can't reproduce it here. Would you please provide a self contained, small
example plus information about the OS, filesystem and compiler as well as a
list of filenames to test with?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20171005/1d5f63c5/attachment.html>

More information about the fpc-pascal mailing list