diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-08-28 23:32:43 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-05-19 03:43:20 +0200 |
commit | b1736191e03302de4ed46bc42ba012d498db34a7 (patch) | |
tree | 0c2dd7a73e9445737dc7d326207c499234cff381 /desktop | |
parent | 38c8bd997713986cf7053737f480a044b7249cf0 (diff) |
start writing the update.info file
Change-Id: I22e8c2d878413ae1b4d61a20c054e04da9d6ccb1
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/updater.cxx | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index 4e232ae934d5..6924a98c7235 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -113,6 +113,29 @@ char** createCommandLine(const OUString& rInstallDir, bool bReplace) return pArgs; } +struct update_file +{ + OUString aURL; + OUString aHash; + size_t nSize; +}; + +struct language_file +{ + update_file aUpdateFile; + OUString aLangCode; +}; + +struct update_info +{ + OUString aFromBuildID; + OUString aSeeAlsoURL; + OUString aNewVersion; + + update_file aUpdateFile; + std::vector<language_file> aLanguageFiles; +}; + } void Update() @@ -140,7 +163,7 @@ void Update() delete[] pArgs; } -void CreateValidUpdateDir() +void CreateValidUpdateDir(const update_info& update_info) { OUString aInstallDir("$BRAND_BASE_DIR"); rtl::Bootstrap::expandMacros(aInstallDir); @@ -163,6 +186,14 @@ void CreateValidUpdateDir() // TODO: remove the update directory SAL_WARN("desktop.updater", "failed to update"); } + else + { + OUString aUpdateInfoURL(aPatchDirURL + "/update.info"); + OUString aUpdateInfoPath = getPathFromURL(aUpdateInfoURL); + SvFileStream aUpdateInfoFile(aUpdateInfoPath, StreamMode::WRITE | StreamMode::TRUNC); + aUpdateInfoFile.WriteCharPtr("[UpdateInfo]\nOldBuildId="); + aUpdateInfoFile.WriteByteStringLine(update_info.aFromBuildID, RTL_TEXTENCODING_UTF8); + } } namespace { @@ -198,29 +229,6 @@ class invalid_update_info : public std::exception { }; -struct update_file -{ - OUString aURL; - OUString aHash; - size_t nSize; -}; - -struct language_file -{ - update_file aUpdateFile; - OUString aLangCode; -}; - -struct update_info -{ - OUString aFromBuildID; - OUString aSeeAlsoURL; - OUString aNewVersion; - - update_file aUpdateFile; - std::vector<language_file> aLanguageFiles; -}; - OUString toOUString(const std::string& rStr) { return OUString::fromUtf8(rStr.c_str()); |