diff options
author | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-09-10 14:16:21 +0200 |
---|---|---|
committer | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-09-10 14:16:21 +0200 |
commit | 1e780cc87b4ee0a96a815358019b9e7b74c798f5 (patch) | |
tree | 8206dd9384e8b5d31cad3f7e95a6224b88d58c46 /testautomation/global/tools/includes/required/t_files.inc | |
parent | 267febb8e0a386a746b8095330394ed6986decfb (diff) |
automationdev300m87: #i112208# - As discussed on IRC we reuse an already existing file instead of deleting/copying it anew. Saves time but also carries a certain but low risk.
Diffstat (limited to 'testautomation/global/tools/includes/required/t_files.inc')
-rw-r--r-- | testautomation/global/tools/includes/required/t_files.inc | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/testautomation/global/tools/includes/required/t_files.inc b/testautomation/global/tools/includes/required/t_files.inc index 5f9be07c6c96..fcdbe5f39c99 100644 --- a/testautomation/global/tools/includes/required/t_files.inc +++ b/testautomation/global/tools/includes/required/t_files.inc @@ -556,9 +556,19 @@ end function ' function hFileOpenLocally( byVal sSourcePath as string ) as boolean - const CFN = "global::tools::includes::required::t_files.inc:hFileOpenLocally(): " + ' Issue #i112208# - implement a function that copies a file from testautomation + ' into the local work directory to avoid that the document gets opened + ' in read-only mode. See details of the implementation in the issue + ' description. + + ' Parameters + ' 1) Path as string, URLs are untested + ' 2) Separator, usually "getPathSeparator" + ' 3) Item number, 0 = last item which usually is the file name from a path. + ' Begin counting with 1, while the function internally accesses item 0 + ' from the array. - GVERBOSE = true + const CFN = "global::tools::includes::required::t_files.inc:hFileOpenLocally(): " dim sTargetPath as string dim sTargetFile as string @@ -574,19 +584,19 @@ function hFileOpenLocally( byVal sSourcePath as string ) as boolean sTargetFile = hSplitString( sSourcePath, getPathSeparator, 0 ) sTargetPath = hGetWorkFile( sTargetFile ) + ' Copy the file from anywhere to the local user directory if it does not + ' exist. This behavior was discussed on IRC if ( FileExists( sTargetPath ) ) then - qaerrorlog( CFN & "Target file already exists, replacing it!" ) - hFileDelete( sTargetPath ) - endif - - if ( GVERBOSE ) then - printlog( CFN & "Copying file" ) - printlog( CFN & "From: " & sSourcePath ) - printlog( CFN & "To..: " & sTargetPath ) + printlog( CFN & "Re-using existing local copy of workfile" ) + else + if ( GVERBOSE ) then + printlog( CFN & "Copying file" ) + printlog( CFN & "From: " & sSourcePath ) + printlog( CFN & "To..: " & sTargetPath ) + endif + FileCopy( sSourcePath, sTargetPath ) endif - ' Copy the file from anywhere to the local user directory - FileCopy( sSourcePath, sTargetPath ) ' This is a hook that allows to access the filename under which the file ' has been saved. Due to restrictive coding guidelines we cannot return |