From 894a0348dc86f60b35d48e51eea9cc465750b494 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Thu, 25 Apr 2013 17:10:46 +0100 Subject: fix VBA mode MkDir when passed folder is not a full path Change-Id: I7fd804999f1b96e6aab112445edcd9dcf7753c24 --- basic/source/runtime/methods.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'basic') diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 9e1b3baa2656..19d52a8cbc8f 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -641,6 +641,28 @@ RTLFUNC(MkDir) if (rPar.Count() == 2) { OUString aPath = rPar.Get(1)->GetOUString(); + if ( SbiRuntime::isVBAEnabled() ) + { + // In vba if the full path is not specified then + // folder is created relative to the curdir + INetURLObject aURLObj( getFullPath( aPath ) ); + if ( aURLObj.GetProtocol() != INET_PROT_FILE ) + { + SbxArrayRef pPar = new SbxArray(); + SbxVariableRef pResult = new SbxVariable(); + SbxVariableRef pParam = new SbxVariable(); + pPar->Insert( pResult, pPar->Count() ); + pPar->Insert( pParam, pPar->Count() ); + SbRtl_CurDir( pBasic, *pPar, bWrite ); + + rtl::OUString sCurPathURL; + File::getFileURLFromSystemPath( pPar->Get(0)->GetOUString(), sCurPathURL ); + + aURLObj.SetURL( sCurPathURL ); + aURLObj.Append( aPath ); + File::getSystemPathFromFileURL(aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI ),aPath ) ; + } + } if( hasUno() ) { -- cgit