Vikthor, I think you could try debugging the C implementation of Harbour鈥檚 FILE() function.
You don鈥檛 have to recompile the Harbour sources for this. Instead, you can debug it directly鈥攐r even replace it with your own extended version鈥攗sing a #pragma BEGINDUMP block inside your PRG file.
Here鈥檚 an example of a debugging version of FILE(): (from AI not tested!)
#pragma BEGINDUMP
#include "hbapi.h"
#include "hbapifs.h"
#include "stdio.h" // for printf
// Custom FILE_DEBUG function
HB_FUNC( FILE_DEBUG )
{
// 1. Get parameter as string
PHB_ITEM pFileName = hb_param( 1, HB_IT_STRING );
const char * szFileName = NULL;
HB_BOOL bExist = FALSE;
if( pFileName && hb_itemType( pFileName ) & HB_IT_STRING )
{
szFileName = hb_itemGetCPtr( pFileName );
// Debug output: show the path being checked
printf( "FILE_DEBUG: checking path -> '%s'\n", szFileName );
fflush( stdout ); // flush immediately
// 2. Call the original Harbour check
// hb_spFile is the internal C function used by FILE()
bExist = hb_spFile( ( const char * ) szFileName, NULL );
// Debug output: show the result
printf( "FILE_DEBUG: result -> %s\n", bExist ? "EXISTS" : "DOES NOT EXIST" );
fflush( stdout );
}
else
{
printf( "FILE_DEBUG: ERROR - no string parameter received!\n" );
fflush( stdout );
}
// Return result to Harbour
hb_retl( bExist );
}
#pragma ENDDUMP
Best regards,
Otto