From f068c2f707f68c91ca61174e3439a4165eb8b1e5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 17 Jun 2009 07:30:31 +0000 Subject: [PATCH] 2009-06-17 09:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbct/fcopy.prg * contrib/xhb/stream.prg * contrib/xhb/traceprg.prg * contrib/xhb/hblog.prg * contrib/xhb/ttable.prg * contrib/hbxbp/xbpmenubar.prg * contrib/hbxbp/xbptoolbar.prg * contrib/hbxbp/xbppushbutton.prg * contrib/hbnf/tbwhile.prg * contrib/rddado/adordd.prg * contrib/hbgd/gd.prg * contrib/hbtip/thtml.prg * contrib/hbtip/popcln.prg * contrib/hbtip/sendmail.prg * contrib/hbtip/cgi.prg * contrib/hbtip/ftpcln.prg % File() -> hb_FileExists(). ; NOTE: I didn't convert in hbblat, because I'm not sure whether wildcards are also expected there. --- harbour/ChangeLog | 21 +++++++++++++++++++++ harbour/contrib/hbct/fcopy.prg | 2 +- harbour/contrib/hbgd/gd.prg | 2 +- harbour/contrib/hbnf/tbwhile.prg | 4 ++-- harbour/contrib/hbtip/cgi.prg | 4 ++-- harbour/contrib/hbtip/ftpcln.prg | 4 ++-- harbour/contrib/hbtip/popcln.prg | 4 ++-- harbour/contrib/hbtip/sendmail.prg | 4 ++-- harbour/contrib/hbtip/thtml.prg | 2 +- harbour/contrib/hbxbp/xbpmenubar.prg | 2 +- harbour/contrib/hbxbp/xbppushbutton.prg | 2 +- harbour/contrib/hbxbp/xbptoolbar.prg | 2 +- harbour/contrib/rddado/adordd.prg | 8 ++++---- harbour/contrib/xhb/hblog.prg | 4 ++-- harbour/contrib/xhb/stream.prg | 2 +- harbour/contrib/xhb/traceprg.prg | 4 ++-- harbour/contrib/xhb/ttable.prg | 14 +++++++------- 17 files changed, 53 insertions(+), 32 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e6597bd022..7ec55db9fb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,27 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-17 09:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbct/fcopy.prg + * contrib/xhb/stream.prg + * contrib/xhb/traceprg.prg + * contrib/xhb/hblog.prg + * contrib/xhb/ttable.prg + * contrib/hbxbp/xbpmenubar.prg + * contrib/hbxbp/xbptoolbar.prg + * contrib/hbxbp/xbppushbutton.prg + * contrib/hbnf/tbwhile.prg + * contrib/rddado/adordd.prg + * contrib/hbgd/gd.prg + * contrib/hbtip/thtml.prg + * contrib/hbtip/popcln.prg + * contrib/hbtip/sendmail.prg + * contrib/hbtip/cgi.prg + * contrib/hbtip/ftpcln.prg + % File() -> hb_FileExists(). + ; NOTE: I didn't convert in hbblat, because I'm not sure whether wildcards + are also expected there. + 2009-06-17 00:10 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbxbp/tests/demoxbp.prg ! Commented out menu option. diff --git a/harbour/contrib/hbct/fcopy.prg b/harbour/contrib/hbct/fcopy.prg index 05299e8076..974d1f48b5 100644 --- a/harbour/contrib/hbct/fcopy.prg +++ b/harbour/contrib/hbct/fcopy.prg @@ -194,7 +194,7 @@ FUNCTION FILEAPPEND( cSrc, cDest ) hSrcFile := FOPEN( cSrc, FO_READ ) IF hSrcFile != -1 - IF !FILE( cDest ) + IF !hb_FileExists( cDest ) hDstFile := FCREATE( cDest ) ELSE hDstFile := FOPEN( cDest, FO_WRITE ) diff --git a/harbour/contrib/hbgd/gd.prg b/harbour/contrib/hbgd/gd.prg index 241ea4f092..b6589321e2 100644 --- a/harbour/contrib/hbgd/gd.prg +++ b/harbour/contrib/hbgd/gd.prg @@ -133,7 +133,7 @@ FUNCTION gdImageFromFile( cFile ) LOCAL hFile := {=>} LOCAL oImage - IF File( cFile ) + IF hb_FileExists( cFile ) HB_FNameSplit( cFile, @cPath, @cName, @cExt, @cDrive ) //TraceLog( cFile, cPath, cName, cExt, cDrive ) cExt := Lower( cExt ) diff --git a/harbour/contrib/hbnf/tbwhile.prg b/harbour/contrib/hbnf/tbwhile.prg index a7b75a5218..d6c6367c2c 100644 --- a/harbour/contrib/hbnf/tbwhile.prg +++ b/harbour/contrib/hbnf/tbwhile.prg @@ -87,13 +87,13 @@ FIELD last, first MEMVAR GetList - IF ! FILE( "tbnames.dbf" ) + IF ! hb_FileExists( "tbnames.dbf" ) MAKE_DBF() ENDIF USE TBNames - IF ! FILE( "tbnames.ntx" ) + IF ! hb_FileExists( "tbnames.ntx" ) INDEX ON last + first TO TBNAMES ENDIF diff --git a/harbour/contrib/hbtip/cgi.prg b/harbour/contrib/hbtip/cgi.prg index 93628d312b..c679ddb25f 100644 --- a/harbour/contrib/hbtip/cgi.prg +++ b/harbour/contrib/hbtip/cgi.prg @@ -111,7 +111,7 @@ ENDCLASS METHOD New() CLASS TIpCgi - local aTemp + local aTemp local aVar local lPost local nCount @@ -409,7 +409,7 @@ METHOD StartSession( cSID ) CLASS TIpCgi cFile := ::cSessionSavePath + "SESSIONID_" + cSID - if file( cFile ) + if hb_FileExists( cFile ) if ( nH := FOpen( cFile, FO_READ ) ) != -1 nFileSize := FSeek( nH, 0, FS_END ) FSeek( nH, 0, FS_SET ) diff --git a/harbour/contrib/hbtip/ftpcln.prg b/harbour/contrib/hbtip/ftpcln.prg index 7031fef932..9dc59abab7 100644 --- a/harbour/contrib/hbtip/ftpcln.prg +++ b/harbour/contrib/hbtip/ftpcln.prg @@ -176,10 +176,10 @@ METHOD New( oUrl,lTrace, oCredentials) CLASS tIPClientFTP ::nDefaultRcvBuffSize := 65536 if ::ltrace - if !file("ftp.log") + if !hb_FileExists("ftp.log") ::nHandle := fcreate("ftp.log") else - while file(cFile+hb_NToS(Int(n))+".log") + while hb_FileExists(cFile+hb_NToS(Int(n))+".log") n++ enddo ::cLogFile:= cFile+hb_NToS(Int(n))+".log" diff --git a/harbour/contrib/hbtip/popcln.prg b/harbour/contrib/hbtip/popcln.prg index 64a35c2f64..a3e961f3c3 100644 --- a/harbour/contrib/hbtip/popcln.prg +++ b/harbour/contrib/hbtip/popcln.prg @@ -94,10 +94,10 @@ METHOD New( oUrl, lTrace, oCredentials ) CLASS tIPClientPOP ::nConnTimeout := 10000 if ::ltrace - if !file("pop3.log") + if !hb_FileExists("pop3.log") ::nHandle := fcreate("pop3.log") else - while file(cFile+hb_NToS(n)+".log") + while hb_FileExists(cFile+hb_NToS(n)+".log") n++ enddo ::nHandle := fcreate(cFile+hb_NToS(n)+".log") diff --git a/harbour/contrib/hbtip/sendmail.prg b/harbour/contrib/hbtip/sendmail.prg index 5b41e8960a..119bafc1ce 100644 --- a/harbour/contrib/hbtip/sendmail.prg +++ b/harbour/contrib/hbtip/sendmail.prg @@ -132,7 +132,7 @@ FUNCTION HB_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF cUser := StrTran( cUser, "@", "&at;" ) - IF !( (".htm" $ Lower( cBody ) .OR. ".html" $ Lower( cBody ) ) .AND. File(cBody) ) + IF !( (".htm" $ Lower( cBody ) .OR. ".html" $ Lower( cBody ) ) .AND. hb_FileExists(cBody) ) IF !( Right( cBody, 2 ) == HB_OSNewLine() ) cBody += HB_OsNewLine() @@ -225,7 +225,7 @@ FUNCTION HB_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF oAttach := tipMail():new() oAttach:SetEncoder( "7-bit" ) - IF (".htm" $ Lower( cBody ) .OR. ".html" $ Lower( cBody ) ) .AND. File(cBody) + IF (".htm" $ Lower( cBody ) .OR. ".html" $ Lower( cBody ) ) .AND. hb_FileExists(cBody) cMimeText := "text/html ; charset=ISO-8859-1" oAttach:hHeaders[ "Content-Type" ] := cMimeText cBodyTemp := cBody diff --git a/harbour/contrib/hbtip/thtml.prg b/harbour/contrib/hbtip/thtml.prg index 907f53fa0a..a57697ac0b 100644 --- a/harbour/contrib/hbtip/thtml.prg +++ b/harbour/contrib/hbtip/thtml.prg @@ -232,7 +232,7 @@ RETURN ::root:toString() // reads HTML file and parses it into tree of objects METHOD readFile( cFileName ) CLASS THtmlDocument - IF ! File( cFileName ) + IF ! hb_FileExists( cFileName ) RETURN .F. ENDIF ::changed := .T. diff --git a/harbour/contrib/hbxbp/xbpmenubar.prg b/harbour/contrib/hbxbp/xbpmenubar.prg index 532acfcd05..b48c264a96 100644 --- a/harbour/contrib/hbxbp/xbpmenubar.prg +++ b/harbour/contrib/hbxbp/xbpmenubar.prg @@ -290,7 +290,7 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos ) cCaption := substr( cCaption, 1, n-1 ) ENDIF oAction:setText( cCaption ) - IF file( cIcon ) + IF hb_FileExists( cIcon ) oAction:setIcon( cIcon ) ENDIF IF !empty( cKey ) diff --git a/harbour/contrib/hbxbp/xbppushbutton.prg b/harbour/contrib/hbxbp/xbppushbutton.prg index ae998906d7..2529564f7d 100644 --- a/harbour/contrib/hbxbp/xbppushbutton.prg +++ b/harbour/contrib/hbxbp/xbppushbutton.prg @@ -186,7 +186,7 @@ METHOD XbpPushButton:setCaption( xCaption, cDll ) IF hb_isChar( xCaption ) ::caption := xCaption - IF file( xCaption ) + IF hb_FileExists( xCaption ) ::oWidget:setIcon( xCaption ) ELSE ::oWidget:setText( xCaption ) diff --git a/harbour/contrib/hbxbp/xbptoolbar.prg b/harbour/contrib/hbxbp/xbptoolbar.prg index aa63efaa9c..17e2fac9f8 100644 --- a/harbour/contrib/hbxbp/xbptoolbar.prg +++ b/harbour/contrib/hbxbp/xbptoolbar.prg @@ -249,7 +249,7 @@ METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS oBtn:oAction := QAction():new( QT_PTROF( ::oWidget ) ) oBtn:oAction:setText( cCaption ) - IF valtype( xImage ) == "C" .and. file( xImage ) + IF valtype( xImage ) == "C" .and. hb_FileExists( xImage ) oBtn:oAction:setIcon( xImage ) ENDIF diff --git a/harbour/contrib/rddado/adordd.prg b/harbour/contrib/rddado/adordd.prg index af4019c8cf..0db434c430 100644 --- a/harbour/contrib/rddado/adordd.prg +++ b/harbour/contrib/rddado/adordd.prg @@ -175,25 +175,25 @@ STATIC FUNCTION ADO_CREATE( nWA, aOpenInfo ) DO CASE CASE Lower( Right( cDataBase, 4 ) ) == ".mdb" - IF ! File( cDataBase ) + IF ! hb_FileExists( cDataBase ) oCatalog:Create( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDataBase ) ENDIF oConnection:Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDataBase ) CASE Lower( Right( cDataBase, 4 ) ) == ".xls" - IF ! File( cDataBase ) + IF ! hb_FileExists( cDataBase ) oCatalog:Create( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDataBase + ";Extended Properties='Excel 8.0;HDR=YES';Persist Security Info=False" ) ENDIF oConnection:Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDataBase + ";Extended Properties='Excel 8.0;HDR=YES';Persist Security Info=False") CASE Lower( Right( cDataBase, 3 ) ) == ".db" - IF ! File( cDataBase ) + IF ! hb_FileExists( cDataBase ) oCatalog:Create( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDataBase + ";Extended Properties='Paradox 3.x';" ) ENDIF oConnection:Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDataBase + ";Extended Properties='Paradox 3.x';" ) CASE Lower( Right( cDataBase, 4 ) ) == ".fdb" - IF ! File( cDataBase ) + IF ! hb_FileExists( cDataBase ) oCatalog:Create( "Driver=Firebird/InterBase(r) driver;Uid=" + cUserName + ";Pwd=" + cPassword + ";DbName=" + cDataBase + ";" ) ENDIF #ifdef __XHARBOUR__ diff --git a/harbour/contrib/xhb/hblog.prg b/harbour/contrib/xhb/hblog.prg index 16db67a325..955b4f84b3 100644 --- a/harbour/contrib/xhb/hblog.prg +++ b/harbour/contrib/xhb/hblog.prg @@ -510,7 +510,7 @@ METHOD Open( cProgName ) CLASS HB_LogFile RETURN .F. ENDIF - IF File( ::cFileName ) + IF hb_FileExists( ::cFileName ) ::nFileHandle := FOpen( ::cFileName, FO_READWRITE ) IF ::nFileHandle > 0 Fseek( ::nFileHandle, 0 ,FS_END ) @@ -559,7 +559,7 @@ METHOD Send( nStyle, cMessage, cProgName, nPrio ) CLASS HB_LogFile FClose( ::nFileHandle ) IF ::nBackup > 1 - IF File( ::cFileName +"." + Padl( ::nBackup-1, 3,"0" ) ) + IF hb_FileExists( ::cFileName +"." + Padl( ::nBackup-1, 3,"0" ) ) FErase( ::cFileName +"." + Padl( ::nBackup-1, 3,"0" ) ) ENDIF FOR nCount := ::nBackup -1 TO 1 STEP -1 diff --git a/harbour/contrib/xhb/stream.prg b/harbour/contrib/xhb/stream.prg index f03d5f3b61..f53fb70f9c 100644 --- a/harbour/contrib/xhb/stream.prg +++ b/harbour/contrib/xhb/stream.prg @@ -218,7 +218,7 @@ METHOD New( cFile, nMode ) CLASS TStreamFileWriter ::cFile := cFile - IF File( cFile ) + IF hb_FileExists( cFile ) DEFAULT nMode TO FO_READWRITE ::Handle := FOpen( cFile, nMode ) diff --git a/harbour/contrib/xhb/traceprg.prg b/harbour/contrib/xhb/traceprg.prg index dc9ead3a35..caaec6481e 100644 --- a/harbour/contrib/xhb/traceprg.prg +++ b/harbour/contrib/xhb/traceprg.prg @@ -83,11 +83,11 @@ FUNCTION TraceLog( ... ) PRIVATE FileHandle PRIVATE ProcName, xParam - /* File() and FOpen()/FCreate() make different assumptions rgdg path, + /* hb_FileExists() and FOpen()/FCreate() make different assumptions rgdg path, so we have to make sure cFile contains path to avoid ambiguity */ cFile := cWithPath( cFile ) - IF File( cFile ) + IF hb_FileExists( cFile ) FileHandle := FOpen( cFile, 1 ) ELSE FileHandle := FCreate( cFile ) diff --git a/harbour/contrib/xhb/ttable.prg b/harbour/contrib/xhb/ttable.prg index 09fbfabe9f..7e291d94be 100644 --- a/harbour/contrib/xhb/ttable.prg +++ b/harbour/contrib/xhb/ttable.prg @@ -179,7 +179,7 @@ FUNCTION NetLock( nType, lReleaseLocks, nSeconds ) xIdentifier := lReleaseLocks bOperation := { | x | DBAPPEND( x ), !NETERR() } exit - END + ENDSWITCH slNetOk := .F. @@ -286,7 +286,7 @@ FUNCTION NetOpenFiles( aFiles ) FOR EACH xFile IN aFiles - IF !FILE( xFile[ 1 ] ) + IF !hb_FileExists( xFile[ 1 ] ) nRet := - 1 EXIT ENDIF @@ -294,7 +294,7 @@ FUNCTION NetOpenFiles( aFiles ) IF NetDbUse( xFile[ 1 ], xFile[ 2 ], snNetDelay, "DBFCDX" ) IF VALTYPE( xFile[ 3 ] ) == "A" FOR EACH cIndex IN xFile[ 3 ] - IF FILE( cIndex ) + IF hb_FileExists( cIndex ) ORDLISTADD( cIndex ) ELSE nRet := - 3 @@ -835,7 +835,7 @@ METHOD OPEN() CLASS HBTable SELECT( ::Alias ) ::Area := SELECT() - IF ::cOrderBag != NIL .and. FILE( ::cPath + ::cOrderFile ) + IF ::cOrderBag != NIL .and. hb_FileExists( ::cPath + ::cOrderFile ) SET INDEX TO ( ::cPath + ::cOrderBag ) ( ::Alias )->( ORDSETFOCUS( 1 ) ) @@ -927,7 +927,7 @@ METHOD FldInit() CLASS HBTable oNew:Read() - IF oNew:cOrderBag != NIL .and. FILE( oNew:cPath + oNew:cOrderFile ) + IF oNew:cOrderBag != NIL .and. hb_FileExists( oNew:cPath + oNew:cOrderFile ) SET INDEX TO ( oNew:cPath + oNew:cOrderBag ) ( oNew:Alias )->( ORDSETFOCUS( 1 ) ) ENDIF @@ -1289,7 +1289,7 @@ METHOD Reindex() CLASS HBTable ::Isnet := .F. - IF FILE( ::cPath + ::cOrderFile ) + IF hb_FileExists( ::cPath + ::cOrderFile ) IF FERASE( ::cPath + ::cOrderFile ) != 0 // --> ALERT(".CDX *NOT* Deleted !!!" ) ENDIF @@ -1330,7 +1330,7 @@ METHOD FastReindex() CLASS HBTable ::Kill() ::Isnet := .F. - IF FILE( ::cPath + ::cOrderFile ) + IF hb_FileExists( ::cPath + ::cOrderFile ) IF FERASE( ::cPath + ::cOrderFile ) != 0 // --> ALERT(".CDX *NOT* Deleted !!!" ) ENDIF