From 2356bfdb1b99a93fcb35fefc0f587158e7d160c2 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 19 Mar 2017 21:25:23 +0100 Subject: [PATCH] uitest: add a way to log the UNO commands Change-Id: Ibbf7fd8e44b0be82e496eab6d98468f03038e60f Reviewed-on: https://gerrit.libreoffice.org/35441 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- sfx2/source/control/unoctitm.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index f82460af8160..3d84cc05edab 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -52,6 +53,7 @@ #include #include #include +#include #include #include @@ -601,6 +603,24 @@ void collectUsageInformation(const util::URL& rURL, const uno::Sequence& /*rArgs*/) +{ + static const char* pFile = std::getenv("LO_COLLECT_UIINFO"); + if (!pFile) + return; + + OUString aCommand = rURL.Protocol + rURL.Path; + + OUString aDirPath("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/uitest/"); + rtl::Bootstrap::expandMacros(aDirPath); + osl::Directory::createPath(aDirPath); + OUString aFilePath = aDirPath + OUString::fromUtf8(pFile); + + SvFileStream aFile(aFilePath, StreamMode::STD_READWRITE); + aFile.Seek(aFile.Tell() + aFile.remainingSize()); + aFile.WriteLine(OUStringToOString(aCommand, RTL_TEXTENCODING_UTF8)); +} + } void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, @@ -608,6 +628,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, const css::uno::Reference< css::frame::XDispatchResultListener >& rListener ) { collectUsageInformation(aURL, aArgs); + collectUIInformation(aURL, aArgs); SolarMutexGuard aGuard; if (