| 207 | } |
| 208 | |
| 209 | bool 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 | { |
no test coverage detected