MCPcopy Create free account
hub / github.com/Kitware/CMake / SettingsFileRead

Method SettingsFileRead

Source/cmQtAutoRcc.cxx:209–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209bool cmQtAutoRccT::SettingsFileRead()
210{
211 // Compose current settings strings
212 {
213 cmCryptoHash cryptoHash(cmCryptoHash::AlgoSHA256);
214 auto cha = [&cryptoHash](cm::string_view value) {
215 cryptoHash.Append(value);
216 cryptoHash.Append(";");
217 };
218 cha(this->RccExecutable_);
219 std::for_each(this->RccListOptions_.begin(), this->RccListOptions_.end(),
220 cha);
221 cha(this->QrcFile_);
222 cha(this->RccPathChecksum_);
223 cha(this->RccFileName_);
224 std::for_each(this->Options_.begin(), this->Options_.end(), cha);
225 std::for_each(this->Inputs_.begin(), this->Inputs_.end(), cha);
226 this->SettingsString_ = cryptoHash.FinalizeHex();
227 }
228
229 // Make sure the settings file exists
230 if (!cmSystemTools::FileExists(this->SettingsFile_, true)) {
231 // Touch the settings file to make sure it exists
232 if (!cmSystemTools::Touch(this->SettingsFile_, true)) {
233 this->Log().Error(GenT::RCC,
234 cmStrCat("Touching the settings file ",
235 this->MessagePath(this->SettingsFile_),
236 " failed."));
237 return false;
238 }
239 }
240
241 // Lock the lock file
242 {
243 // Make sure the lock file exists
244 if (!cmSystemTools::FileExists(this->LockFile_, true)) {
245 if (!cmSystemTools::Touch(this->LockFile_, true)) {
246 this->Log().Error(GenT::RCC,
247 cmStrCat("Touching the lock file ",
248 this->MessagePath(this->LockFile_),
249 " failed."));
250 return false;
251 }
252 }
253 // Lock the lock file
254 cmFileLockResult lockResult = this->LockFileLock_.Lock(
255 this->LockFile_, static_cast<unsigned long>(-1));
256 if (!lockResult.IsOk()) {
257 this->Log().Error(GenT::RCC,
258 cmStrCat("Locking of the lock file ",
259 this->MessagePath(this->LockFile_),
260 " failed.\n", lockResult.GetOutputMessage()));
261 return false;
262 }
263 }
264
265 // Read old settings
266 {

Callers 1

ProcessMethod · 0.95

Calls 12

FinalizeHexMethod · 0.80
IsOkMethod · 0.80
GetOutputMessageMethod · 0.80
cmStrCatFunction · 0.70
FileExistsFunction · 0.50
AppendMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
ErrorMethod · 0.45
LogMethod · 0.45
MessagePathMethod · 0.45
LockMethod · 0.45

Tested by

no test coverage detected