Fixed system independant location of "temporary" directory for parcel preperation.

This commit is contained in:
Noel Power
2002-09-24 14:50:28 +00:00
parent b74fc71203
commit a5d786d578

View File

@@ -2,8 +2,8 @@
* *
* $RCSfile: ScriptStorage.cxx,v $ * $RCSfile: ScriptStorage.cxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* last change: $Author: lkovacs $ $Date: 2002-09-23 14:17:49 $ * last change: $Author: npower $ $Date: 2002-09-24 15:50:28 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -66,6 +66,8 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <drafts/com/sun/star/script/framework/storage/ScriptImplInfo.hpp> #include <drafts/com/sun/star/script/framework/storage/ScriptImplInfo.hpp>
#include <osl/file.hxx>
#include <util/util.hxx> #include <util/util.hxx>
#include "ScriptInfo.hxx" #include "ScriptInfo.hxx"
@@ -508,15 +510,6 @@ throw (lang::IllegalArgumentException,
} }
//************************************************************************* //*************************************************************************
/**
copies a parcel to a temporary location
@params parcelURI
the location of the parcel (file URI) to be copied
@return
<type>::rtl::OUString</type> the new location of the parcel (file URI)
*/
OUString SAL_CALL ScriptStorage::prepareForInvocation( const OUString& parcelURI ) throw (RuntimeException) OUString SAL_CALL ScriptStorage::prepareForInvocation( const OUString& parcelURI ) throw (RuntimeException)
{ {
try try
@@ -532,7 +525,9 @@ OUString SAL_CALL ScriptStorage::prepareForInvocation( const OUString& parcelURI
Reference<XInterface> ()); Reference<XInterface> ());
} }
OUString dest = OUString::createFromAscii("file:///tmp"); OUString dest;
::osl::FileBase::getTempDirURL(dest);
sal_Int32 idx = parcelURI.lastIndexOf('/'); sal_Int32 idx = parcelURI.lastIndexOf('/');
sal_Int32 len = parcelURI.getLength(); sal_Int32 len = parcelURI.getLength();
if (idx == (len-1)) if (idx == (len-1))
@@ -561,13 +556,6 @@ OUString SAL_CALL ScriptStorage::prepareForInvocation( const OUString& parcelURI
throw RuntimeException(temp.concat(e.Message), throw RuntimeException(temp.concat(e.Message),
Reference<XInterface> ()); Reference<XInterface> ());
} }
catch(Exception &e)
{
OUString temp = OUSTR(
"ScriptStorage::prepareForInvocation UnknownException: ");
throw RuntimeException(temp.concat(e.Message),
Reference<XInterface> ());
}
#ifdef _DEBUG #ifdef _DEBUG
catch ( ... ) catch ( ... )
{ {
@@ -580,18 +568,12 @@ OUString SAL_CALL ScriptStorage::prepareForInvocation( const OUString& parcelURI
//************************************************************************* //*************************************************************************
/** /**
This function copies the contents of the source folder into the * This function copies the contents of the source folder into the
destination folder. If the destination folder does not exist, it * destination folder. If the destination folder does not exist, it
is created. If the destination folder exists, it is deleted and then * is created. If the destination folder exists, it is deleted and then
created. All URIs supported by the relevant XSimpleFileAccess * created. All URIs supported by the relevant XSimpleFileAccess
implementation are supported. * implementation are supported.
*/
@params src
the source folder (file URI)
@params dest
the destination folder (file URI)
*/
void ScriptStorage::copyFolder(const OUString &src, const OUString &dest) throw (RuntimeException) void ScriptStorage::copyFolder(const OUString &src, const OUString &dest) throw (RuntimeException)
{ {
try try