diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 15:45:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 15:45:17 +0100 |
commit | c2288bd3cb1343d881634e674bf31f41430567cf (patch) | |
tree | f7c9320a7c587c3c86ddb01d1319f24ce6442a04 /pyuno | |
parent | fcc44a688d0f2b9855a7fa82cb8b48f165ba75ab (diff) |
#i112656# add osl_setEnvironment and osl_clearEnvironment
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/loader/pyuno_loader.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index c0d0eecebbe3..73d6086c0119 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -124,8 +124,7 @@ static void setPythonHome ( const OUString & pythonHome ) static void prependPythonPath( const OUString & pythonPathBootstrap ) { - rtl::OStringBuffer bufPYTHONPATH( 256 ); - bufPYTHONPATH.append( "PYTHONPATH="); + rtl::OUStringBuffer bufPYTHONPATH( 256 ); sal_Int32 nIndex = 0; while( 1 ) { @@ -141,21 +140,19 @@ static void prependPythonPath( const OUString & pythonPathBootstrap ) } OUString systemPath; osl_getSystemPathFromFileURL( fileUrl.pData, &(systemPath.pData) ); - bufPYTHONPATH.append( rtl::OUStringToOString( systemPath.pData, osl_getThreadTextEncoding() )); - bufPYTHONPATH.append( SAL_PATHSEPARATOR ); + bufPYTHONPATH.append( systemPath ); + bufPYTHONPATH.append( static_cast<sal_Unicode>(SAL_PATHSEPARATOR) ); if( nNew == -1 ) break; nIndex = nNew + 1; } const char * oldEnv = getenv( "PYTHONPATH"); if( oldEnv ) - bufPYTHONPATH.append( oldEnv ); - OString result = bufPYTHONPATH.makeStringAndClear(); - rtl_string_acquire( result.pData ); - -// printf( "Setting %s\n" , result.pData->buffer ); - putenv( result.pData->buffer ); + bufPYTHONPATH.append( rtl::OUString(oldEnv, strlen(oldEnv), osl_getThreadTextEncoding()) ); + rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("PYTHONPATH")); + rtl::OUString envValue(bufPYTHONPATH.makeStringAndClear()); + osl_setEnvironment(envVar.pData, envValue.pData); } Reference< XInterface > CreateInstance( const Reference< XComponentContext > & ctx ) |