diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-24 01:14:53 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-05-19 03:43:30 +0200 |
commit | b65cf7da60cc7eb9815e094e704d475fe115c23e (patch) | |
tree | a2bd9953f7a4c7a038cd29f6ae87671d9ac4f221 /desktop/source | |
parent | a1ae46afb9068e0d1408d27f6e6b433143bb9131 (diff) |
extract the common updater path info into methods
Change-Id: I8d25fc3c6a6a0a7e05bac6679f2312a904e75bbd
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/app.cxx | 10 | ||||
-rw-r--r-- | desktop/source/app/updater.cxx | 46 | ||||
-rw-r--r-- | desktop/source/app/updater.hxx | 13 |
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: */ |