diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-10-15 11:47:55 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-10-15 11:47:55 +0000 |
commit | dd91cba0426a1e25234d3170b32bfedffda22d1a (patch) | |
tree | 2578d3ad43b451cbc17b8f72953e09a717d13ec7 /sal/osl/all | |
parent | 9b18bc99d5ce00675299cb5a8a10fa939076ebb3 (diff) |
INTEGRATION: CWS sb71 (1.1.2); FILE ADDED
2007/10/12 07:25:53 sb 1.1.2.3: #i75466# better variant of the previous change
2007/10/11 17:02:12 sb 1.1.2.2: Make osl_loadModuleRelative work for absolute urls, too.
2007/06/26 13:36:37 sb 1.1.2.1: #i75466# Added osl_loadModuleRelative.
Diffstat (limited to 'sal/osl/all')
-rw-r--r-- | sal/osl/all/loadmodulerelative.cxx | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/sal/osl/all/loadmodulerelative.cxx b/sal/osl/all/loadmodulerelative.cxx new file mode 100644 index 000000000000..8dfb4366acc7 --- /dev/null +++ b/sal/osl/all/loadmodulerelative.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loadmodulerelative.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-10-15 12:47:55 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2007 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sal.hxx" + +#include "sal/config.h" + +#include <cstddef> + +#include "osl/diagnose.h" +#include "osl/module.h" +#include "osl/module.hxx" +#include "osl/thread.h" +#include "rtl/malformeduriexception.hxx" +#include "rtl/uri.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +extern "C" { + +oslModule SAL_CALL osl_loadModuleRelative( + oslGenericFunction const baseModule, rtl_uString * const relativePath, + sal_Int32 const mode) +{ + ::rtl::OUString base; + if (!::osl::Module::getUrlFromAddress(baseModule, base)) { + OSL_TRACE("osl::Module::getUrlFromAddress failed"); + return NULL; + } + ::rtl::OUString abs; + try { + abs = ::rtl::Uri::convertRelToAbs(base, relativePath); + } catch (::rtl::MalformedUriException & e) { + (void) e; // avoid warnings + OSL_TRACE( + "rtl::MalformedUriException <%s>", + rtl::OUStringToOString(e.getMessage(), osl_getThreadTextEncoding()). + getStr()); + //TODO: let some OSL_TRACE variant take care of text conversion? + return NULL; + } + return ::osl_loadModule(abs.pData, mode); +} + +} |