Page 1 of 1

cFilePath() bug

PostPosted: Wed Jul 05, 2006 8:52 am
by Enrico Maria Giordano
The followin sample shows "\" while it should show "" (empty string):

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    ? CFILEPATH( "test.txt" )

    RETURN NIL


EMG

PostPosted: Thu Jul 06, 2006 11:20 am
by Antonio Linares
Enrico,

This may fix it:
Code: Select all  Expand view
function cFilePath( cPathMask )   // returns path of a filename

   local n := RAt( "\", cPathMask ), cDisk

return If( n > 0, Upper( Left( cPathMask, n ) ),;
           ( cDisk := cFileDisc( cPathMask ) ) + If( ! Empty( cDisk ), "\", "" ) )

PostPosted: Thu Jul 06, 2006 12:00 pm
by Enrico Maria Giordano
Thank you.

EMG