Skip to content

Commit

Permalink
Small cleanups for the new Win32 update installer.
Browse files Browse the repository at this point in the history
[#291]
  • Loading branch information
Martin Robinson committed Feb 25, 2010
1 parent 2448f17 commit 4421681
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions installation/net_installer/win32/update_installer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,24 @@ static void ExitWithError(const std::string& message, int exitCode)

static wstring GetDependencyDescription(SharedDependency d)
{
string result;

if (d->type == MODULE)
return UTF8ToWide(d->name) + L" module";
result = d->name + " module";
else if (d->type == SDK)
return L" SDK";
result = " SDK";
else if (d->type == MOBILESDK)
return L" Mobile SDK";
result = " Mobile SDK";
else if (d->type == APP_UPDATE)
return L" application update";
result = " application update";
else
return L" runtime";
result = " runtime";

result.append(" (");
result.append(d->version);
result.append(")");

return UTF8ToWide(result);
}

static bool HandleAllJobs(SharedApplication app, vector<SharedDependency>& jobs)
Expand All @@ -78,7 +86,7 @@ static bool HandleAllJobs(SharedApplication app, vector<SharedDependency>& jobs)
SharedDependency dep(jobs.at(i));
wstring description(GetDependencyDescription(dep));

wstring text(L"Downloading the ");
wstring text(L"Downloading the");
text.append(description);
dialog->SetLineText(2, text, false);
if (!DownloadDependency(app, dep))
Expand Down Expand Up @@ -165,22 +173,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
string utf8Update(WideToUTF8(updateFile));
app = Application::NewApplication(utf8Update, utf8Path);

// Always delete the update file as soon as possible. That
// way the application can continue booting even if the update
// cannot be downloaded.
//// Always delete the update file as soon as possible. That
//// way the application can continue booting even if the update
//// cannot be downloaded.
FileUtils::DeleteFile(utf8Update);
}

if (app.isNull())
ExitWithError("The installer could not read the application manifest.", __LINE__);

// If this is an application update, add a job for the update to
// this list of necessary jobs.
if (!updateFile.empty())
{
// If this is an application update, add a job for the update to
// this list of necessary jobs.
jobs.push_back(Dependency::NewDependencyFromValues(
APP_UPDATE, "appupdate", app->version));
}

if (app.isNull())
ExitWithError("The installer could not read the application manifest.", __LINE__);

// This is a legacy action for Windows, but if the install file didn't
// exist just write it out and finish up.
Expand Down

0 comments on commit 4421681

Please sign in to comment.