Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ bool downloadBinary(const wstring& urlFrom, const wstring& destTo, const wstring
return true;
}

bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const GupExtraOptions& proxyServer, const wstring& customParam, const wstring& version)
bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const GupExtraOptions& proxyServer, const wstring& customParam, const wstring& version, const wstring& customInfoURL)
{
char errorBuffer[CURL_ERROR_SIZE] = { 0 };

Expand All @@ -941,7 +941,9 @@ bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const
curl = curl_easy_init();
if (curl)
{
std::wstring urlComplete = gupParams.getInfoLocation() + L"?version=";
wstring infoURL = customInfoURL.empty() ? gupParams.getInfoLocation() : customInfoURL;

std::wstring urlComplete = infoURL + L"?version=";
if (!version.empty())
urlComplete += version;
else
Expand Down Expand Up @@ -1170,6 +1172,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int)

wstring version;
wstring customParam;
wstring customInfoUrl;

ParamVector params;
parseCommandLine(lpszCmdLine, params);
Expand All @@ -1182,6 +1185,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int)

getParamVal('v', params, version);
getParamVal('p', params, customParam);
getParamVal('i', params, customInfoUrl); // Optional. If empty, the value in gup.xml will be used.

// Object (gupParams) is moved here because we need app icon form configuration file
GupParameters gupParams(L"gup.xml");
Expand Down Expand Up @@ -1442,7 +1446,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int)

isSilentMode = gupParams.isSilentMode();

bool getUpdateInfoSuccessful = getUpdateInfo(updateInfo, gupParams, extraOptions, customParam, version);
bool getUpdateInfoSuccessful = getUpdateInfo(updateInfo, gupParams, extraOptions, customParam, version, customInfoUrl);

if (!getUpdateInfoSuccessful)
{
Expand Down
21 changes: 10 additions & 11 deletions src/xmlTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,17 @@ GupParameters::GupParameters(const wchar_t * xmlFileName)
}

TiXmlNode *infoURLNode = root->FirstChildElement("InfoUrl");
if (!infoURLNode)
throw exception("InfoUrl node is missed.");

TiXmlNode *iu = infoURLNode->FirstChild();
if (!iu)
throw exception("InfoUrl is missed.");

const char *iuVal = iu->Value();
if (!iuVal || !(*iuVal))
throw exception("InfoUrl is missed.");

_infoUrl = s2ws(iuVal);
if (infoURLNode)
{
TiXmlNode* iu = infoURLNode->FirstChild();
if (iu)
{
const char* iuVal = iu->Value();
if (iuVal)
_infoUrl = s2ws(iuVal);
}
}

TiXmlNode *classeNameNode = root->FirstChildElement("ClassName2Close");
if (classeNameNode)
Expand Down