Page 1 of 1

cFilePath() bug

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

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    ? CFILEPATH( "test.txt" )

    RETURN NIL
EMG

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

This may fix it:

Code: Select all

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 ), "\", "" ) )

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

EMG