Continuo testando, afinal, é a rotina de checagem de índices do meu sistema, e não dá pra ficar sem ela.
Até postei nos desenvolvedores.
E isso me lembra aqueles bugs do File() que já aconteceu com mais de uma pessoa.
Segue o post nos desenvolvedores, mais completo porque fiz mais testes hoje:
it's a crazy bug.
Routine:
Código: Selecionar todos
IF .NOT. UpperFile( PathAndFile( cDbf ) + ".CDX" )
SayScroll( "Não encontrou " + PathAndFile( cDbf ) + ".CDX" )
Inkey(3)
...
ENDIF
...
FUNCTION PathAndFile( cFileName )
cFileName := Lower( cFileName )
SayScroll( "FileName " + cFileName )
IF cFileName $ "-jpcidade-"
SayScroll( "Entrou no IF" )
cFileName := AppCommonFolder() + cFileName
SayScroll( "Novo nome" + cFileName )
ENDIF
RETURN cFileName
FUNCTION UpperFile( cFile )
LOCAL lAchou := .T., cTexto
DO CASE
CASE File( cFile )
CASE File( Upper( cFile ) )
cTexto := "Falhou File(" + cFile + ") e funcionou File(" + Upper( cFile ) + ")" + HB_EOL()
cTexto += "Set( _SET_FILECASE ) = " + Transform( Set( _SET_FILECASE ), "" ) + HB_EOL()
cTexto += "Set( _SET_DIRCASE ) = " + Transform( Set( _SET_DIRCASE ), "" ) + HB_EOL()
WriteErrorLog( cTexto, 2 )
CASE hb_FileExists( cFile )
cTexto := "Falhou File(" + cFile + ") e funcionou hb_FileExists(" + cFile + ")"
cTexto += "Set( _SET_FILECASE ) = " + Transform( Set( _SET_FILECASE ), "" ) + HB_EOL()
cTexto += "Set( _SET_DIRCASE ) = " + Transform( Set( _SET_DIRCASE ), "" ) + HB_EOL()
WriteErrorLog( cTexto, 2 )
OTHERWISE
lAchou := .F.
ENDCASE
RETURN lAchou
If I remove IF...ENDIF from PathAndFile() all works ok.
if I add a line with cFileName := Upper( cFileName ) in PathAndFile() all works ok. (don't enter in IF for any file)
But if..endif modify only one filename, not all filenames, I add messages to make a debug and confirm this.
At momment I don't know what to do.
partial log
FileName jpbarra
FileName jpcadas
FileName jpcadas
FileName jpcadas
FileName jpcadas
Não encontrou jpcadas.CDX
FileName jpcadas
FileName jpcadas
FileName jpcadas
FileName jpcidade
Entrou no IF
Novo Nome..\jpcidade
FileName jpcidade
Entrou no IF
Novo Nome..\jpcidade
FileName jpcidade
Entrou no IF
Novo Nome..\jpcidade
FileName jpcidade
Entrou no IF
Novo Nome..\jpcidade
FileName jpclista
FileName jpclista
FileName jpclista
FileName jpclista
Não encontrou jpclista.CDX
FileName jpclista
FileName jpclista
FileName jpclista
FileName jpcomiss
FileName jpcomiss
FileName jpcomiss
FileName jpcomiss
Não encontrou jpcomiss.CDX
Looking the log:
- only jpcidade enter in IF
- no other filename is changed (then remove if..endif don't change other filenames)
- CDX exists in folder
In this post I see:
- Before jpcidade, CDX is found
- If change filename in IF...ENDIF, bug is moved to another position
- Few time ago I read about some low level functions make directory open for "cache", it's the only thing I can think: cache a wrong directory in multithread
- Alternative folder is "..\" (don't know if this information can help)
Note: this test is running in one thread, but there is the main process running in another thread.