mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2025-02-24 11:51:15 +00:00
Report an error on update installation if the update script cannot be read.
This commit is contained in:
parent
82de2a91f8
commit
bae300a6a7
4 changed files with 28 additions and 0 deletions
|
@ -55,8 +55,27 @@ std::list<std::string> UpdateInstaller::updaterArgs() const
|
|||
return args;
|
||||
}
|
||||
|
||||
void UpdateInstaller::reportError(const std::string& error)
|
||||
{
|
||||
if (m_observer)
|
||||
{
|
||||
m_observer->updateError(error);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateInstaller::run() throw ()
|
||||
{
|
||||
if (!m_script || !m_script->isValid())
|
||||
{
|
||||
reportError("Unable to read update script");
|
||||
return;
|
||||
}
|
||||
if (m_installDir.empty())
|
||||
{
|
||||
reportError("No installation directory specified");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string updaterPath;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ class UpdateInstaller
|
|||
void uninstallFiles();
|
||||
void installFile(const UpdateScriptFile& file);
|
||||
void backupFile(const std::string& path);
|
||||
void reportError(const std::string& error);
|
||||
|
||||
std::list<std::string> updaterArgs() const;
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ UpdateScript::UpdateScript()
|
|||
|
||||
void UpdateScript::parse(const std::string& path)
|
||||
{
|
||||
m_path.clear();
|
||||
|
||||
TiXmlDocument document(path);
|
||||
if (document.LoadFile())
|
||||
{
|
||||
|
@ -38,6 +40,11 @@ void UpdateScript::parse(const std::string& path)
|
|||
}
|
||||
}
|
||||
|
||||
bool UpdateScript::isValid() const
|
||||
{
|
||||
return !m_path.empty();
|
||||
}
|
||||
|
||||
void UpdateScript::parseUpdate(const TiXmlElement* updateNode)
|
||||
{
|
||||
const TiXmlElement* depsNode = updateNode->FirstChildElement("dependencies");
|
||||
|
|
|
@ -57,6 +57,7 @@ class UpdateScript
|
|||
|
||||
void parse(const std::string& path);
|
||||
|
||||
bool isValid() const;
|
||||
const std::string path() const;
|
||||
const std::vector<std::string>& dependencies() const;
|
||||
const std::vector<UpdateScriptPackage>& packages() const;
|
||||
|
|
Loading…
Reference in a new issue