basic/source/runtime/methods.cxx |   42 +++++++++++++++++----------------------
 1 file changed, 19 insertions(+), 23 deletions(-)

New commits:
commit 5d8fe7fbc7c9c5a5a1ab22de7a329f9e9a36c530
Author:     Ludwig Temmel <[email protected]>
AuthorDate: Mon Nov 17 00:24:40 2025 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Nov 17 05:21:28 2025 +0100

    tdf#147132 Flatten Basic function implementations
    
    Flattened SbRtl_FileExists()
    
    Change-Id: I5e635d5c05ad7b4f1497530f075e580935870608
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194081
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 3505ec044f36..45061c1ba6b0 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4270,38 +4270,34 @@ void SbRtl_DumpAllObjects(StarBASIC * pBasic, SbxArray 
& rPar, bool)
 
 void SbRtl_FileExists(StarBASIC *, SbxArray & rPar, bool)
 {
-    if (rPar.Count() == 2)
-    {
-        OUString aStr = rPar.Get(1)->GetOUString();
-        bool bExists = false;
+    if (rPar.Count() != 2)
+        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 
-        if( hasUno() )
+    OUString aStr = rPar.Get(1)->GetOUString();
+    bool bExists = false;
+
+    if( hasUno() )
+    {
+        const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = 
getFileAccess();
+        if( xSFI.is() )
         {
-            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = 
getFileAccess();
-            if( xSFI.is() )
+            try
             {
-                try
-                {
-                    bExists = xSFI->exists( aStr );
-                }
-                catch(const Exception & )
-                {
-                    StarBASIC::Error( ERRCODE_IO_GENERAL );
-                }
+                bExists = xSFI->exists( aStr );
+            }
+            catch(const Exception & )
+            {
+                StarBASIC::Error( ERRCODE_IO_GENERAL );
             }
         }
-        else
-        {
-            DirectoryItem aItem;
-            FileBase::RC nRet = DirectoryItem::get( getFullPath( aStr ), aItem 
);
-            bExists = (nRet == FileBase::E_None);
-        }
-        rPar.Get(0)->PutBool(bExists);
     }
     else
     {
-        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+        DirectoryItem aItem;
+        FileBase::RC nRet = DirectoryItem::get( getFullPath( aStr ), aItem );
+        bExists = (nRet == FileBase::E_None);
     }
+    rPar.Get(0)->PutBool(bExists);
 }
 
 void SbRtl_Partition(StarBASIC *, SbxArray & rPar, bool)

Reply via email to