summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-04-24 01:14:53 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-05-19 02:49:04 +0200
commit6c93b4693d17d648f33b6250c54ccf1434ff0c26 (patch)
tree0f16388abd5b2f43a34577fa229fd4142395faf3
parenteither try to install an update or check for update (diff)
downloadcore-6c93b4693d17d648f33b6250c54ccf1434ff0c26.tar.gz
core-6c93b4693d17d648f33b6250c54ccf1434ff0c26.zip
extract the common updater path info into methods
Change-Id: I8d25fc3c6a6a0a7e05bac6679f2312a904e75bbd
-rw-r--r--desktop/source/app/app.cxx10
-rw-r--r--desktop/source/app/updater.cxx46
-rw-r--r--desktop/source/app/updater.hxx13
3 files changed, 53 insertions, 16 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 388b45dfb943..09457b88b3c9 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1471,19 +1471,13 @@ int Desktop::Main()
#if HAVE_FEATURE_UPDATE_MAR
if (officecfg::Office::Update::Update::Enabled::get())
{
- OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/");
- rtl::Bootstrap::expandMacros(aPatchDirURL);
-
osl::DirectoryItem aPatchInfo;
- osl::DirectoryItem::get(aPatchDirURL + "/update.info", aPatchInfo);
+ osl::DirectoryItem::get(Updater::getUpdateInfoURL(), aPatchInfo);
if (aPatchInfo.is())
{
- OUString aInstallationDir( "$BRAND_BASE_DIR/");
- rtl::Bootstrap::expandMacros(aInstallationDir);
-
osl::DirectoryItem aDirectoryItem;
- osl::DirectoryItem::get(aInstallationDir + "/updated", aDirectoryItem);
+ osl::DirectoryItem::get(Updater::getUpdateDirURL(), aDirectoryItem);
bool bValidUpdateDirExists = aDirectoryItem.is();
if (bValidUpdateDirExists)
{
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index e82e84f41bc6..a0e0e3bf4f6f 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -140,7 +140,7 @@ char** createCommandLine()
}
{
// directory with the patch log
- OUString aPatchDir("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/");
+ OUString aPatchDir = Updater::getPatchDirURL();
rtl::Bootstrap::expandMacros(aPatchDir);
OUString aTempDirPath = getPathFromURL(aPatchDir);
createStr(aTempDirPath, pArgs, 1);
@@ -152,9 +152,8 @@ char** createCommandLine()
}
{
// the temporary updated build
- OUString aPatchDir("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/update_dir/");
- rtl::Bootstrap::expandMacros(aPatchDir);
- OUString aWorkingDir = getPathFromURL(aPatchDir);
+ OUString aUpdateDirURL = Updater::getUpdateDirURL();
+ OUString aWorkingDir = getPathFromURL(aUpdateDirURL);
createStr(aWorkingDir, pArgs, 3);
}
{
@@ -162,15 +161,14 @@ char** createCommandLine()
createStr(pPID, pArgs, 4);
}
{
- OUString aExeDir( "$BRAND_BASE_DIR/" LIBO_BIN_FOLDER "/" );
+ OUString aExeDir = Updater::getExecutableDirURL();
OUString aSofficePath = getPathFromURL(aExeDir);
createStr(aSofficePath, pArgs, 5);
}
{
// the executable to start after the successful update
- OUString aSofficeDir( "$BRAND_BASE_DIR/" LIBO_BIN_FOLDER "/" );
- rtl::Bootstrap::expandMacros(aSofficeDir);
- OUString aSofficePathURL = aSofficeDir + OUString::fromUtf8(pSofficeExeName);
+ OUString aExeDir = Updater::getExecutableDirURL();
+ OUString aSofficePathURL = aExeDir + OUString::fromUtf8(pSofficeExeName);
OUString aSofficePath = getPathFromURL(aSofficePathURL);
createStr(aSofficePath, pArgs, 6);
}
@@ -564,4 +562,36 @@ void update_checker()
}
}
+OUString Updater::getUpdateInfoURL()
+{
+ OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/update.info");
+ rtl::Bootstrap::expandMacros(aUpdateInfoURL);
+
+ return aUpdateInfoURL;
+}
+
+OUString Updater::getPatchDirURL()
+{
+ OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/");
+ rtl::Bootstrap::expandMacros(aPatchDirURL);
+
+ return aPatchDirURL;
+}
+
+OUString Updater::getUpdateDirURL()
+{
+ OUString aUpdateDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/update_dir/");
+ rtl::Bootstrap::expandMacros(aUpdateDirURL);
+
+ return aUpdateDirURL;
+}
+
+OUString Updater::getExecutableDirURL()
+{
+ OUString aExeDir( "$BRAND_BASE_DIR/" LIBO_BIN_FOLDER "/" );
+ rtl::Bootstrap::expandMacros(aExeDir);
+
+ return aExeDir;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/app/updater.hxx b/desktop/source/app/updater.hxx
index fa5349afbe11..b36c1f91b306 100644
--- a/desktop/source/app/updater.hxx
+++ b/desktop/source/app/updater.hxx
@@ -16,6 +16,19 @@ void update();
void update_checker();
+class Updater
+{
+private:
+
+public:
+
+ static OUString getUpdateInfoURL();
+ static OUString getPatchDirURL();
+ static OUString getUpdateDirURL();
+ static OUString getExecutableDirURL();
+
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */