LCOV - code coverage report
Current view: top level - libreoffice/cppuhelper/source - paths.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 18 88.9 %
Date: 2012-12-27 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "sal/config.h"
      21             : 
      22             : #include "com/sun/star/uno/DeploymentException.hpp"
      23             : #include "com/sun/star/uno/Reference.hxx"
      24             : #include "com/sun/star/uno/XInterface.hpp"
      25             : #include "osl/module.hxx"
      26             : #include "osl/mutex.hxx"
      27             : #include "rtl/ustring.hxx"
      28             : #include "sal/types.h"
      29             : 
      30             : #include "paths.hxx"
      31             : 
      32         516 : rtl::OUString cppu::get_this_libpath() {
      33         516 :     static rtl::OUString s_uri;
      34         516 :     if (s_uri.isEmpty()) {
      35         257 :         rtl::OUString uri;
      36             :         osl::Module::getUrlFromAddress(
      37         257 :             reinterpret_cast< oslGenericFunction >(get_this_libpath), uri);
      38         257 :         sal_Int32 i = uri.lastIndexOf('/');
      39         257 :         if (i == -1) {
      40             :             throw css::uno::DeploymentException(
      41           0 :                 "URI " + uri + " is expected to contain a slash",
      42           0 :                 css::uno::Reference< css::uno::XInterface >());
      43             :         }
      44         257 :         uri = uri.copy(0, i);
      45         257 :         osl::MutexGuard guard(osl::Mutex::getGlobalMutex());
      46         257 :         if (s_uri.isEmpty()) {
      47         257 :             s_uri = uri;
      48         257 :         }
      49             :     }
      50         516 :     return s_uri;
      51             : }
      52             : 
      53         516 : rtl::OUString cppu::getUnoIniUri() {
      54             : #if defined ANDROID
      55             :     // Wouldn't it be lovely to avoid this fugly hard-coding.
      56             :     // The problem is that the 'create_bootstrap_macro_expander_factory()'
      57             :     // required for bootstrapping services, calls cppu::get_unorc directly
      58             :     // instead of re-using the BoostrapHandle from:
      59             :     //     defaultBootstrap_InitialComponentContext
      60             :     // and since rtlBootstrapHandle is not ref-counted doing anything
      61             :     // clean here is hardish.
      62             :     rtl::OUString uri("file:///assets/program");
      63             : #else
      64         516 :     rtl::OUString uri(get_this_libpath());
      65             : #endif
      66         516 :     return uri + "/" SAL_CONFIGFILE("uno");
      67             : }
      68             : 
      69             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10