mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
refs #497, changed and improved handling of bootstrap files
* changed global setup (port, root directory) * version for bootstrap files
This commit is contained in:
committed by
Mathew Sutcliffe
parent
23856bbc57
commit
03f4aa6889
@@ -85,15 +85,21 @@ namespace BlackCore
|
||||
QString dir(CProject::getSwiftPrivateResourceDir());
|
||||
if (dir.isEmpty()) { return false; }
|
||||
|
||||
fileName = CFileUtils::appendFilePaths(dir, "bootstrap/setup.json");
|
||||
fileName = CFileUtils::appendFilePaths(dir, "bootstrap/" + CGlobalSetup::versionString() + "/bootstrap.json");
|
||||
QString content(CFileUtils::readFileToString(fileName));
|
||||
if (content.isEmpty()) { return false; }
|
||||
CGlobalSetup s;
|
||||
s.convertFromJson(content);
|
||||
s.setDevelopment(true);
|
||||
m_setup.set(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSetupReader::isForDevelopment()
|
||||
{
|
||||
return CProject::useDevelopmentSetup();
|
||||
}
|
||||
|
||||
CUrlList CSetupReader::getRemainingUrls() const
|
||||
{
|
||||
CUrlList urls(m_setup.get().bootstrapUrls().appendPath(appendPathAndFile()));
|
||||
@@ -103,9 +109,9 @@ namespace BlackCore
|
||||
|
||||
QString CSetupReader::appendPathAndFile()
|
||||
{
|
||||
return CProject::useDevelopmentSetup() ?
|
||||
"development/bootstrap.json" :
|
||||
"productive/bootstrap.json";
|
||||
return isForDevelopment() ?
|
||||
CGlobalSetup::versionString() + "/development/bootstrap.json" :
|
||||
CGlobalSetup::versionString() + "/productive/bootstrap.json";
|
||||
}
|
||||
|
||||
void CSetupReader::ps_parseSetupFile(QNetworkReply *nwReplyPtr)
|
||||
@@ -145,13 +151,12 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
QString type(urlString.toLower().contains("develop") ? "DEV" : "PRODUCTIVE");
|
||||
CGlobalSetup currentSetup(m_setup.get());
|
||||
CGlobalSetup currentSetup(m_setup.get()); // from cache
|
||||
CGlobalSetup loadedSetup;
|
||||
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
||||
loadedSetup.setType(type);
|
||||
loadedSetup.setDevelopment(isForDevelopment()); // always update, regardless what persistent setting says
|
||||
if (loadedSetup.getMSecsSinceEpoch() == 0 && lastModified > 0) { loadedSetup.setMSecsSinceEpoch(lastModified); }
|
||||
bool sameType = loadedSetup.hasSameType(currentSetup.getType());
|
||||
bool sameType = loadedSetup.hasSameType(currentSetup);
|
||||
qint64 currentVersionTimestamp = currentSetup.getMSecsSinceEpoch();
|
||||
qint64 newVersionTimestamp = loadedSetup.getMSecsSinceEpoch();
|
||||
bool sameVersionLoaded = sameType && (newVersionTimestamp == currentVersionTimestamp);
|
||||
|
||||
Reference in New Issue
Block a user