summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2017-04-30 01:33:36 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2017-04-29 18:38:09 +0200
commitad3e1afe5969d6c53b1ed285b7c36685bd457b1c (patch)
tree3a474dabeaeb593ce876073b2fe93df940697a6f
parentunotools: cleanup bootstrap.hxx (diff)
downloadcore-ad3e1afe5969d6c53b1ed285b7c36685bd457b1c.tar.gz
core-ad3e1afe5969d6c53b1ed285b7c36685bd457b1c.zip
Move getProcessWorkingDir from tools to unotools
Change-Id: Ifd86ab3c89c285ad5329fc86cc57967ebd1af91a Reviewed-on: https://gerrit.libreoffice.org/37100 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r--desktop/source/app/cmdlineargs.cxx4
-rw-r--r--desktop/source/app/officeipcthread.cxx7
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx25
-rw-r--r--include/tools/getprocessworkingdir.hxx40
-rw-r--r--include/unotools/bootstrap.hxx4
-rw-r--r--lingucomponent/source/lingutil/lingutil.cxx4
-rw-r--r--tools/Library_tl.mk1
-rw-r--r--tools/source/misc/getprocessworkingdir.cxx60
-rw-r--r--unotools/source/config/bootstrap.cxx31
9 files changed, 54 insertions, 122 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 579ea99f6199..b86fe45d3b80 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -33,7 +33,7 @@
#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
-#include <tools/getprocessworkingdir.hxx>
+#include <unotools/bootstrap.hxx>
#include <svl/documentlockfile.hxx>
@@ -79,7 +79,7 @@ public:
m_index(0)
{
OUString url;
- if (tools::getProcessWorkingDir(url)) {
+ if (utl::Bootstrap::getProcessWorkingDir(url)) {
m_cwdUrl.reset(url);
}
}
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index f48260507dca..7e712bc3fdd5 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -45,7 +45,6 @@
#include <cppuhelper/supportsservice.hxx>
#include <osl/file.hxx>
#include <rtl/process.h>
-#include <tools/getprocessworkingdir.hxx>
#include <algorithm>
#include <cassert>
@@ -494,7 +493,7 @@ RequestHandler::Status DbusIpcThread::enable(rtl::Reference<IpcThread> * thread)
{
OStringBuffer buf(ARGUMENT_PREFIX);
OUString arg;
- if (!(tools::getProcessWorkingDir(arg)
+ if (!(utl::Bootstrap::getProcessWorkingDir(arg)
&& addArgument(buf, '1', arg)))
{
buf.append('0');
@@ -875,7 +874,7 @@ RequestHandler::Status PipeIpcThread::enable(rtl::Reference<IpcThread> * thread)
OStringBuffer aArguments(ARGUMENT_PREFIX);
OUString cwdUrl;
- if (!(tools::getProcessWorkingDir(cwdUrl) &&
+ if (!(utl::Bootstrap::getProcessWorkingDir(cwdUrl) &&
addArgument(aArguments, '1', cwdUrl)))
{
aArguments.append('0');
@@ -1309,7 +1308,7 @@ static void AddConversionsToDispatchList(
}
else
{
- ::tools::getProcessWorkingDir( aPWD );
+ utl::Bootstrap::getProcessWorkingDir( aPWD );
}
if( !::osl::FileBase::getAbsoluteFileURL( aPWD, rParamOut, aOutDir ) )
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index bf40197682d7..c74d9e0d98aa 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -19,11 +19,8 @@
#include <config_folders.h>
-#include "deployment.hrc"
-#include "unopkg_shared.h"
-#include "dp_identifier.hxx"
-#include "dp_gui.hrc"
-#include "lockfile.hxx"
+#include <stdio.h>
+
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <rtl/bootstrap.hxx>
@@ -32,14 +29,20 @@
#include <osl/process.h>
#include <osl/file.hxx>
#include <osl/thread.hxx>
-#include <tools/getprocessworkingdir.hxx>
-#include <comphelper/processfactory.hxx>
#include <unotools/configmgr.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+#include <unotools/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <comphelper/sequence.hxx>
-#include <stdio.h>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
+
+#include "deployment.hrc"
+#include "unopkg_shared.h"
+#include "dp_identifier.hxx"
+#include "dp_gui.hrc"
+#include "lockfile.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -169,7 +172,7 @@ struct ProcessWorkingDir : public rtl::StaticWithInit<
OUString, ProcessWorkingDir> {
const OUString operator () () {
OUString workingDir;
- tools::getProcessWorkingDir(workingDir);
+ utl::Bootstrap::getProcessWorkingDir(workingDir);
return workingDir;
}
};
diff --git a/include/tools/getprocessworkingdir.hxx b/include/tools/getprocessworkingdir.hxx
deleted file mode 100644
index b0dbe709dcdb..000000000000
--- a/include/tools/getprocessworkingdir.hxx
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_TOOLS_GETPROCESSWORKINGDIR_HXX
-#define INCLUDED_TOOLS_GETPROCESSWORKINGDIR_HXX
-
-#include <rtl/ustring.hxx>
-#include <tools/toolsdllapi.h>
-
-
-namespace tools {
-
-// get the process's current working directory, taking OOO_CWD into account
-//
-// @param rUrl
-// Receives the directory URL (with or without a final slash) upon successful
-// return, and the empty string upon unsuccessful return
-TOOLS_DLLPUBLIC bool getProcessWorkingDir(OUString& rUrl);
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/bootstrap.hxx b/include/unotools/bootstrap.hxx
index f00c7b1de8f7..6c6663c588bb 100644
--- a/include/unotools/bootstrap.hxx
+++ b/include/unotools/bootstrap.hxx
@@ -108,6 +108,10 @@ namespace utl
static Status checkBootstrapStatus(OUString& _rDiagnosticMessage, FailureCode& _rErrCode);
public:
+ /// get the working directory of the process
+ static bool getProcessWorkingDir(OUString &rUrl);
+
+ public:
// singleton impl-class
class Impl;
static const Impl& data(); // the data related to the bootstrap.ini file
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index fd7151fc7b07..5ecb404ae9df 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -26,9 +26,9 @@
#include <osl/process.h>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
-#include <tools/getprocessworkingdir.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <unotools/bootstrap.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/pathoptions.hxx>
#include <rtl/ustring.hxx>
@@ -200,7 +200,7 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
OUString aRelative;
OUString aAbsolute;
- if (!tools::getProcessWorkingDir(aCWD))
+ if (!utl::Bootstrap::getProcessWorkingDir(aCWD))
continue;
if (osl::FileBase::getFileURLFromSystemPath(aSystem, aRelative)
!= osl::FileBase::E_None)
diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk
index 04231aaed139..86c24fdbb984 100644
--- a/tools/Library_tl.mk
+++ b/tools/Library_tl.mk
@@ -69,7 +69,6 @@ $(eval $(call gb_Library_add_exception_objects,tl,\
tools/source/memtools/unqidx \
tools/source/misc/cpuid \
tools/source/misc/extendapplicationenvironment \
- tools/source/misc/getprocessworkingdir \
tools/source/rc/rc \
tools/source/rc/resary \
tools/source/rc/resmgr \
diff --git a/tools/source/misc/getprocessworkingdir.cxx b/tools/source/misc/getprocessworkingdir.cxx
deleted file mode 100644
index dfe0b6d13a94..000000000000
--- a/tools/source/misc/getprocessworkingdir.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/config.h>
-
-#include <cstddef>
-
-#include <osl/diagnose.h>
-#include <osl/file.hxx>
-#include <osl/process.h>
-#include <rtl/bootstrap.hxx>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-#include <tools/getprocessworkingdir.hxx>
-
-namespace tools {
-
-bool getProcessWorkingDir(OUString &rUrl)
-{
- rUrl.clear();
- OUString s("$OOO_CWD");
- rtl::Bootstrap::expandMacros(s);
- if (s.isEmpty())
- {
- if (osl_getProcessWorkingDir(&rUrl.pData) == osl_Process_E_None)
- return true;
- }
- else if (s[0] == '1')
- {
- rUrl = s.copy(1);
- return true;
- }
- else if (s[0] == '2' &&
- (osl::FileBase::getFileURLFromSystemPath(s.copy(1), rUrl) ==
- osl::FileBase::E_None))
- {
- return true;
- }
- return false;
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index f423909f64ff..50bfa18fb5ae 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -19,6 +19,7 @@
#include <config_folders.h>
+#include <cstddef>
#include <stdio.h>
#include <unotools/bootstrap.hxx>
@@ -33,7 +34,9 @@
#include <rtl/bootstrap.hxx>
#include <rtl/instance.hxx>
#include <osl/process.h>
-#include <tools/getprocessworkingdir.hxx>
+
+#include <osl/diagnose.h>
+#include <osl/file.hxx>
// #define this to true, if remembering defaults is not supported properly
#define RTL_BOOTSTRAP_DEFAULTS_BROKEN true
@@ -123,6 +126,30 @@ const Bootstrap::Impl& Bootstrap::data()
return theImpl::get();
}
+bool Bootstrap::getProcessWorkingDir(OUString &rUrl)
+{
+ rUrl.clear();
+ OUString s("$OOO_CWD");
+ rtl::Bootstrap::expandMacros(s);
+ if (s.isEmpty())
+ {
+ if (osl_getProcessWorkingDir(&rUrl.pData) == osl_Process_E_None)
+ return true;
+ }
+ else if (s[0] == '1')
+ {
+ rUrl = s.copy(1);
+ return true;
+ }
+ else if (s[0] == '2' &&
+ (osl::FileBase::getFileURLFromSystemPath(s.copy(1), rUrl) ==
+ osl::FileBase::E_None))
+ {
+ return true;
+ }
+ return false;
+}
+
void Bootstrap::reloadData()
{
theImpl::get().initialize();
@@ -209,7 +236,7 @@ static bool implEnsureAbsolute(OUString & _rsURL) // also strips embedded dots !
using osl::File;
OUString sBasePath;
- OSL_VERIFY(tools::getProcessWorkingDir(sBasePath));
+ OSL_VERIFY(Bootstrap::getProcessWorkingDir(sBasePath));
OUString sAbsolute;
if ( File::E_None == File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))