Re: [fpc-pascal] Finding long file names

2017-10-06 Thread James Richters
>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?

Well, here’s some good news, I was cutting and pasting my code to make a self 
contained example and I found my problem, but to my surprise, my sample program 
was working fine.. I had to do a lot of digging, but I finally found the 
problem…  There was some old code left over from the dos days to identify files 
by extension that wasn’t working right with more than one ‘.’  I modernized the 
function and it’s working great now!  I thought I took care of all the Dos 
limitations over a year ago, but I missed this one.  Thanks for the help, 
knowing it was working for someone else got me to the problem.

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Finding long file names

2017-10-05 Thread Sven Barth via fpc-pascal
Am 05.10.2017 01:49 schrieb "James Richters" :
>
> 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?

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Finding long file names

2017-10-05 Thread Michael Van Canneyt



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:
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?



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.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Finding long file names

2017-10-04 Thread James Richters
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?

James


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal