diff options
author | Andreas Schlüns <as@openoffice.org> | 2001-09-26 08:45:06 +0000 |
---|---|---|
committer | Andreas Schlüns <as@openoffice.org> | 2001-09-26 08:45:06 +0000 |
commit | 3fc0d75096454b07fa5549818af0bab5dce8fbfd (patch) | |
tree | d563746a119dcfd5955cb13232e5f6d3c1f91a3d /desktop/source | |
parent | b631118f5fa28ab4cf488b14a5f2442b7d543479 (diff) |
#91475# use right current working dir for relativ pathes
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/app.cxx | 29 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 15 |
2 files changed, 32 insertions, 12 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 4a27d831df3e..1cffa7f91d18 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2,9 +2,9 @@ * * $RCSfile: app.cxx,v $ * - * $Revision: 1.50 $ + * $Revision: 1.51 $ * - * last change: $Author: mav $ $Date: 2001-09-26 09:16:22 $ + * last change: $Author: as $ $Date: 2001-09-26 09:45:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -186,6 +186,9 @@ #ifndef _OSL_FILE_HXX_ #include <osl/file.hxx> #endif +#ifndef _OSL_PROCESS_H_ +#include <osl/process.h> +#endif #ifndef AUTOMATION_HXX #include <automation/automation.hxx> #endif @@ -1338,14 +1341,22 @@ String GetURL_Impl( const String& rName ) // so in the remote case we can't handle relative filenames as arguments, because they // are parsed relative to the program path // the file system of the client is addressed through the "file:" protocol - ::rtl::OUString aProgName, aTmp; - ::vos::OStartupInfo aInfo; - aInfo.getExecutableFile( aProgName ); - aTmp = aProgName; - INetURLObject aObj( aTmp ); + + // Get current working directory to support relativ pathes + ::rtl::OUString aWorkingDir; + osl_getProcessWorkingDir( &aWorkingDir.pData ); + + // Add path seperator to these directory and make given URL (rName) absolute by using of current working directory + // Attention: "setFianlSlash()" is neccessary for calling "smartRel2Abs()"!!! + // Otherwhise last part will be ignored and wrong result will be returned!!! + // "smartRel2Abs()" interpret given URL as file not as path. So he truncate last element to get the base path ... + // But if we add a seperator - he doesn't do it anymore. + INetURLObject aObj( aWorkingDir ); + aObj.setFinalSlash(); + bool bWasAbsolute; - INetURLObject aURL = aObj.smartRel2Abs( rName, bWasAbsolute ); - String aFileURL = aURL.GetMainURL(INetURLObject::NO_DECODE); + INetURLObject aURL = aObj.smartRel2Abs( rName, bWasAbsolute ); + String aFileURL = aURL.GetMainURL(INetURLObject::NO_DECODE); ::osl::FileStatus aStatus( FileStatusMask_FileURL ); ::osl::DirectoryItem aItem; diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index e00a356a9864..53b9b06377b1 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -2,9 +2,9 @@ * * $RCSfile: officeipcthread.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: lla $ $Date: 2001-09-18 13:54:18 $ + * last change: $Author: as $ $Date: 2001-09-26 09:45:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,6 +88,8 @@ using namespace ::com::sun::star::frame; #define LOOKUP_SEQUENCE "InternalIPC::Lookup" #define LOOKUP_LENGTH 19 +String GetURL_Impl( const String& rName ); + namespace desktop { @@ -95,7 +97,6 @@ OfficeIPCThread* OfficeIPCThread::pGlobalOfficeIPCThread = 0; OSecurity OfficeIPCThread::maSecurity; ::osl::Mutex* OfficeIPCThread::pOfficeIPCThreadMutex = 0; - class ImplForeignAppEventClass { public: @@ -275,6 +276,14 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() for( ULONG i=0; i < nCount; i++ ) { aInfo.getCommandArg( i, aDummy ); + // Make absolute pathes from relative ones! + // It's neccessary to use current working directory of THESE office instance and not of + // currently running once, which get these information by using pipe. + // Otherwhise relativ pathes are not right for his environment ... + if( aDummy.indexOf('-',0) != 0 ) + { + aDummy = GetURL_Impl( aDummy ); + } aArguments += ByteString( String( aDummy ), osl_getThreadTextEncoding() ); aArguments += '|'; } |