After the long threads:
thread #
1173721 Invalid subscript referencethread #
1173982 ADIR, SYS(2000) and Filer all returned wrong resultsI put attention on the issue, with VFP9 SP2 CTP.
Well, the short filename is a terrible MS's workaround,
( rather to make certain things is better to lose the compatibility ),
but for me the VFP routines that processing wildcards are fully bad.
Some internal C++ pointers become wrong,
and during the tests VFP9 has gone to crash 3 times in deterministic way,
(I don't have time to eviscerate this condition).
But even if it was a consequence of the short names used in windows,
and even if it was an error of windows, it is to owe of the VFP team to create
of the usable commands.
(I to my clients don't respond that my application doesn't work because VFP,SQL Server,Windows or others have some bugs, if I find bugs
I have to revolve them, without unloading the guilt on others)
this is the repro,
where SYS(2000) ( and ADIR )
return various "false positive".
the only workaround is
it consists of filtering with
LIKE(m.FindName,result)
the results
MD TESTFINDFILE
CD TESTFINDFILE
CREATE CURSOR FOUND (postlike C(8),fName C(254))
STRTOFILE("","P1S.0")
STRTOFILE("","P1S.1")
STRTOFILE("","P 1S.1")
STRTOFILE("","P 1 S.1")
STRTOFILE("","P 1T.1")
STRTOFILE("","P1 S.1")
STRTOFILE("","P1 T.1")
STRTOFILE("","P1 X.1")
findMask("P1*.1")
findMask("*1S.1")
findMask("*1?.1")
findMask("*2.1")
CD ..
ERASE "TESTFINDFILE\*.*"
CD TESTFINDFILE
STRTOFILE("","P 2S.XXX")
STRTOFILE("","P 3S.XXX")
findMask("*4*.XXX")
findMask("*1*.XXX")
findMask("*4*.XXX")
STRTOFILE("","P 1S.XXX")
findMask("*2*.XXX")
STRTOFILE("","P 4S.XXX")
STRTOFILE("","P 5S.XXX")
findMask("*4*.XXX")
CD ..
ERASE "TESTFINDFILE\*.*"
CD TESTFINDFILE
STRTOFILE("","AAAAAAAAAAAAAAA1S.XXX")
STRTOFILE("","AAAAAAAAAAAAAAA2T.XXX")
STRTOFILE("","AAAAAAAAAAAAAAA3U.XXX")
STRTOFILE("","AAAAAAAAAAAAAAA4V.XXX")
findMask("*2*.XXX")
findMask("*1*.XXX")
STRTOFILE("","AAAAAAAAAAAAAAA5S.XXX")
findMask("*2*.XXX")
findMask("*1*.XXX")
CD ..
ERASE "TESTFINDFILE\*.*"
CD TESTFINDFILE
STRTOFILE("","AAAAAAAAAAAAAA1S.XXX")
STRTOFILE("","AAAAAAAAAAAAAA2T.XXX")
STRTOFILE("","AAAAAAAAAAAAAA3U.XXX")
STRTOFILE("","AAAAAAAAAAAAAA4V.XXX")
findMask("*2*.XXX")
findMask("*1*.XXX")
STRTOFILE("","AAAAAAAAAAAAAA5S.XXX")
findMask("*2*.XXX")
findMask("*1*.XXX")
CD ..
ERASE "TESTFINDFILE\*.*"
RD TESTFINDFILE
LOCATE
BROWSE NAME oBrowse NOWAIT
oBrowse.SetAll("DynamicForecolor","IIF(postlike='OK',0,IIF(postlike='WRONG',255,0x8F0000))")
PROCEDURE findMask(FindName)
INSERT INTO found VALUES ("","---- SYS(2000) ----" + m.FindName)
fLocate=SYS(2000,m.FindName)
DO WHILE NOT EMPTY(m.fLocate)
INSERT INTO found VALUES (IIF(LIKE(m.FindName,m.fLocate),"OK","WRONG"),m.fLocate)
fLocate=SYS(2000,m.FindName,1)
ENDDO
SYS(2000,"")
INSERT INTO found VALUES ("","---- ADIR ----" + m.FindName)
FOR k=1 TO ADIR(aLocate,m.FindName)
INSERT INTO found VALUES (IIF(LIKE(m.FindName,aLocate[m.k,1]),"OK","WRONG"),aLocate[m.k,1])
NEXT
INSERT INTO found VALUES ("","")