vitomation01: #i109696 - Removed wrapper function hFileExists() - it does exactly the same as the builtin function FileExists() plus some overhead.

This commit is contained in:
Joerg Skottke [jsk] 2010-03-02 09:10:47 +01:00
parent 4e81c9a743
commit 263994914d
19 changed files with 53 additions and 70 deletions

View file

@ -248,7 +248,7 @@ sub DateiSperren( Datei$ )
'///+ OUTPUT: - ///'
Dim i%
if hFileExists ( Datei$ ) <> TRUE then
if FileExists ( Datei$ ) <> TRUE then
Warnlog "File '" + Datei$ + "' doesn't exist; exiting now!"
exit sub
end if
@ -270,7 +270,7 @@ sub DateiFreigeben( Datei$ )
'///+ OUTPUT: - ///'
Dim i%
if hFileExists ( Datei$ ) <> TRUE then
if FileExists ( Datei$ ) <> TRUE then
Warnlog "File '" + Datei$ + "' doesn't exist; exiting now!"
exit sub
end if

View file

@ -37,15 +37,6 @@
'*
'\************************************************************************
function hFileExists ( file as String ) as Boolean
'/// Checks if a file exists
'/// <u>Input</u>: Filename with complete path
'/// <u>Return</u>: TRUE or FALSE if the file exists.
hFileExists() = FileExists( file )
end function
'
'-------------------------------------------------------------------------------
'
function DirNameList (ByVal sPfad$ , lsDirName() as String ) as Integer
'/// seperate a path in its parts
'/// <u>Input</u>: Path to seperate; Empty list, because it get's reset in this function!;

View file

@ -950,7 +950,7 @@ function hIsAccessbridgeInstalled() as boolean
sAccessBridgeFolder = "Java Access Bridge"
sCompareString = sProgramFiles & "\" & sAccessBridgeFolder & "\AccessBridgeTester.class"
sAccessibilityCompare = "with accessibility support"
if hFileExists(sCompareString) = True then
if ( FileExists( sCompareString ) ) then
AccessbridgeIsInstalled = True
else
ToolsOptions

View file

@ -153,7 +153,7 @@ testcase tToolsAutocorrectCustomQuotes(bSimple as boolean)
sFileName = (ConvertPath ( gTesttoolPath + "graphics\required\input\rightfont." + ExtensionString))
endif
if hFileExists ( sFileName ) = FALSE then
if FileExists ( sFileName ) = FALSE then
warnlog "The language-file was not found or accessible! The test ends."
goto endsub
endif

View file

@ -110,7 +110,7 @@ testcase tiToolsThesaurus
else
sFileName = (ConvertPath (gTesttoolPath + "graphics\required\input\engtext.odg"))
end if
if hFileExists ( sFileName ) = FALSE then
if FileExists ( sFileName ) = FALSE then
warnlog "The language-file was not found or accessible! The test ends."
goto endsub
end if

View file

@ -126,7 +126,7 @@ testcase tiToolsThesaurus
else
sFileName = (ConvertPath (gTesttoolPath + "graphics\required\input\engtext.odg"))
end if
if hFileExists ( sFileName ) = FALSE then
if FileExists ( sFileName ) = FALSE then
warnlog "The language-file was not found or accessible! The test ends."
goto endsub
end if

View file

@ -435,7 +435,7 @@ testcase tFilePrint
DokumentWriter.MouseUp 99,99
sFileName = convertpath( gOfficePath + "user/work/math/level1/ftc_a.odt")
if (hFileExists(sFileName)) then
if (FileExists(sFileName)) then
'/// goto end of page; insert page break ///'
kontext "DokumentWriter"
DokumentWriter.typeKeys "<mod1 end>"
@ -666,20 +666,12 @@ function hSpeichernUnterMitFilterKillTBO (sFileName as String, sFilterName, opti
Dim bAlienNotAllowed as boolean
sDerName = ConvertPath (sFileName)
if hFileExists (sDerName) = TRUE then
try
app.kill (sDerName)
catch
Exceptlog
endcatch
end if
if FileExists(sDerName) then
warnlog "file '" & sDerName & "' couldn't be deleted. Exiting function now..."
if ( not hDeleteFile( sDerName ) ) then
warnlog( "Aborting function because the file could not be deleted: " & sDerName )
hSpeichernUnterMitFilterKillTBO() = FALSE
exit function
end if
endif
sleep (1)
FileSaveAs
Kontext "SpeichernDlg"

View file

@ -146,7 +146,7 @@ function fCalcFileOpen (sDocName as string, optional bLinked as boolean) as bool
sSourceFile = ConvertPath ( sDocName )
fCalcFileOpen = TRUE
if hFileExists (sSourceFile) = FALSE then
if FileExists (sSourceFile) = FALSE then
warnlog "fCalcFileOpen: '" + sSourceFile + "' does not exists!"
fCalcFileOpen = FALSE
else

View file

@ -931,7 +931,7 @@ testcase tLine_6
soeFile = ConvertPath(gOfficePath + "user\work\standard_reserver.soe")
soeDefaultFile = ConvertPath(gOfficePath + "user\config\standard.soe")
if hFileExists ( soeFile ) then app.kill ( soeFile )
if FileExists ( soeFile ) then app.kill ( soeFile )
PrintLog "- check the attributes in format/line/arrow styles"
@ -1013,7 +1013,7 @@ testcase tLine_6
Kontext
Kontext "TabLinienenden"
if hFileExists ( soeDefaultFile ) then app.kill ( soeDefaultFile )
if FileExists ( soeDefaultFile ) then app.kill ( soeDefaultFile )
Speichern.Click
Kontext

View file

@ -616,7 +616,7 @@ testcase tGroup_12
PrintLog "- Edit object group via Menu Format/Group/Edit Group"
sDocument = ConvertPath ( gOfficePath +"user\work\tGroup_12.odt")
if hFileExists ( sDocument ) then app.kill ( sDocument )
if FileExists ( sDocument ) then app.kill ( sDocument )
Call hNewDocument

View file

@ -407,7 +407,7 @@ testcase tDocumentFilename
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if

View file

@ -283,7 +283,7 @@ testcase tDocInformationUserDefined
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
@ -367,7 +367,7 @@ testcase tDocInformationCreated
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
@ -481,7 +481,7 @@ testcase tDocInformationModified
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
@ -497,7 +497,7 @@ testcase tDocInformationModified
printlog "Doc Information - Modified"
'/// <b> Doc Information - Modified </b>
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
Call hNewDocument
@ -591,7 +591,7 @@ testcase tDocInformationModified
endcatch
end if
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
endcase
@ -618,7 +618,7 @@ testcase tDocInformationModifiedSavefile
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
@ -631,7 +631,7 @@ testcase tDocInformationModifiedSavefile
sFixResult(1) = "08/18/2000"
sFixResult(2) = "11:40:11"
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
printlog "Doc Information - Modified (save file)"
'/// <b> Doc Information - Modified (save file)</b>
@ -713,7 +713,7 @@ testcase tDocInformationModifiedSavefile
endcatch
end if
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
endcase
@ -737,7 +737,7 @@ testcase tDocInformationPrinted
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
@ -866,13 +866,13 @@ testcase tDocInformationRevisionnumber
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
sSaveasFile = ConvertPath (gOfficePath + "user\work\tDocInformationRevisionnumber.sxw" )
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
printlog "Doc Information - Revision number"
'/// <b> Doc Information - Revision number</b>
@ -945,7 +945,7 @@ testcase tDocInformationRevisionnumber
endcatch
end if
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
endcase
@ -965,13 +965,13 @@ testcase tDocInformationTotaleditingtime
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
sSaveasFile = ConvertPath (gOfficePath + "user\work\tDocInformationRevisionnumber.sxw" )
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
printlog "Doc Information - Tatal editing time"
'/// <b> Doc Information - Tatal editing time </b>
@ -1033,7 +1033,7 @@ testcase tDocInformationTotaleditingtime
endcatch
end if
if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile )
endcase

View file

@ -691,7 +691,7 @@ testcase tVariablesDDEFieldManual
printlog "DDE field - manual"
'/// <b> DDE field - manual </b>
if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
if FileExists ( sDDEFile ) then app.kill ( sDDEFile )
Call hNewDocument
@ -759,7 +759,7 @@ testcase tVariablesDDEFieldManual
Call hCloseDocument
if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
if FileExists ( sDDEFile ) then app.kill ( sDDEFile )
endcase
@ -784,7 +784,7 @@ testcase tVariablesDDEFieldAutomatic
printlog "DDE field - automatic"
'/// <b> DDE field - automatic </b>
if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
if FileExists ( sDDEFile ) then app.kill ( sDDEFile )
Call hNewDocument
@ -838,7 +838,7 @@ testcase tVariablesDDEFieldAutomatic
Call hCloseDocument
if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
if FileExists ( sDDEFile ) then app.kill ( sDDEFile )
endcase

View file

@ -226,7 +226,7 @@ testcase tL10NtestDate
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if
@ -349,7 +349,7 @@ testcase tL10NtestTime
' document has to be copied to local file system to avoid opening a read-only file
' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
FileCopy (sOriginalFile, sTestFile)
if hFileExists ( sTestFile ) = false then
if FileExists ( sTestFile ) = false then
Warnlog "Test document couldn't be copied to local file system. Test aborted!"
goto endsub
end if

View file

@ -454,7 +454,7 @@ testcase tExportTop5FormatsIntoTop5
Call hCloseDocument
Loop
printlog " - check if file exists"
if hFileExists (sCurrentSaveFile) then
if FileExists (sCurrentSaveFile) then
printlog " - success"
printlog " - reload previously saved file"
if hFileOpenWithFilter(sCurrentSaveFile, sCurrentSaveFilter) = true then

View file

@ -1196,11 +1196,11 @@ testcase tScenarioSection_1
j = UBound(SectionName)
if hFileExists ( MasterDoc ) then app.kill ( MasterDoc )
if FileExists ( MasterDoc ) then app.kill ( MasterDoc )
For i = 0 to j
tempFile = Convertpath( gOfficePath + "user\work\" + SectionName(i) )
if hFileExists ( tempFile ) then app.kill ( tempFile )
if FileExists ( tempFile ) then app.kill ( tempFile )
next i
'/// open testdocument (tScenarioSection_1.sxw) ///
@ -1316,11 +1316,11 @@ testcase tScenarioSection_2
j = UBound(SectionName)
if hFileExists ( MasterDoc ) then app.kill ( MasterDoc )
if FileExists ( MasterDoc ) then app.kill ( MasterDoc )
For i = 0 to j
tempFile = Convertpath( gOfficePath + "user\work\" + SectionName(i) )
if hFileExists ( tempFile ) then app.kill ( tempFile )
if FileExists ( tempFile ) then app.kill ( tempFile )
next i
'/// open testdocument (tScenarioSection_2.sxw) ///

View file

@ -58,7 +58,7 @@ testcase tToolsSpellcheckWithShortcut
'/// Check if Spellcheck dialog comes up with shortcut 'F7'
printlog " Open document where the formatting is set to the language we wish to test."
TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt")
if hFileExists ( TheFile ) <> TRUE then
if FileExists ( TheFile ) <> TRUE then
Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer."
exit sub
end if
@ -126,7 +126,7 @@ testcase tToolsSpellcheckCorrect
Dim FFText as String
TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt")
if hFileExists ( TheFile ) <> TRUE then
if FileExists ( TheFile ) <> TRUE then
Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer."
exit sub
end if
@ -225,7 +225,7 @@ testcase tToolsSpellcheck1Mistake
Dim TheFile as String
TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt")
if hFileExists ( TheFile ) <> TRUE then
if FileExists ( TheFile ) <> TRUE then
Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer."
exit sub
end if
@ -732,7 +732,7 @@ testcase tToolsSpellcheckAutomatic
Dim TheFile as String
TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt")
if hFileExists ( TheFile ) <> TRUE then
if FileExists ( TheFile ) <> TRUE then
Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer."
exit sub
end if
@ -1244,7 +1244,7 @@ testcase tToolsThesaurus
printlog " Open document where the formatting is set to the language we wish to test."
TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt")
if hFileExists ( TheFile ) <> TRUE then
if FileExists ( TheFile ) <> TRUE then
Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer."
exit sub
end if

View file

@ -86,7 +86,7 @@ testcase tToolsSpellcheck
printlog " Open document where the formatting is set to the language we wish to test."
TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt")
if ( not hFileExists ( TheFile ) ) then
if ( not FileExists ( TheFile ) ) then
Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer."
goto endsub
end if
@ -249,7 +249,7 @@ testcase tToolsThesaurus
printlog " Open document where the formatting is set to the language we wish to test."
TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt")
if ( not hFileExists ( TheFile ) ) then
if ( not FileExists ( TheFile ) ) then
Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer."
goto endsub
end if
@ -345,7 +345,7 @@ testcase tToolsHyphenation
LingFile = str$(iSprache) + "-hyph.dat"
end select
if ( not hFileExists( DieDatei ) ) then
if ( not FileExists( DieDatei ) ) then
Warnlog "No defined Errortext for language: " + isprache + "! Exit!"
goto endsub
end if
@ -1238,7 +1238,7 @@ testcase tMasterDocToolsHyphenation
end select
sTestFile = convertpath( sTestFile )
if ( not hFileExists( sTestFile ) )then
if ( not FileExists( sTestFile ) )then
Warnlog "No defined Errortext for language: " + isprache + "! Exit!"
goto endsub
end if

View file

@ -149,7 +149,7 @@ function wGetSpellcheckDocumentName(xCategory as integer) as string
end select
if sReturn <> "None" then
if hFileExists(sTemp) then
if FileExists(sTemp) then
sReturn = sTemp
else
sReturn = "Empty"