cFilePath() bug

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

cFilePath() bug

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Antonio Linares
www.fivetechsoft.com
Post Reply