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-17 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         442 : rtl::OUString cppu::get_this_libpath() {
      33         442 :     static rtl::OUString s_uri;
      34         442 :     if (s_uri.isEmpty()) {
      35         308 :         rtl::OUString uri;
      36             :         osl::Module::getUrlFromAddress(
      37         308 :             reinterpret_cast< oslGenericFunction >(get_this_libpath), uri);
      38         308 :         sal_Int32 i = uri.lastIndexOf('/');
      39         308 :         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         308 :         uri = uri.copy(0, i);
      45         308 :         osl::MutexGuard guard(osl::Mutex::getGlobalMutex());
      46         308 :         if (s_uri.isEmpty()) {
      47         308 :             s_uri = uri;
      48         308 :         }
      49             :     }
      50         442 :     return s_uri;
      51             : }
      52             : 
      53         428 : 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         428 :     rtl::OUString uri(get_this_libpath());
      65             : #endif
      66         428 :     return uri + "/" SAL_CONFIGFILE("uno");
      67             : }
      68             : 
      69             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10