| 219 | } |
| 220 | |
| 221 | bool Deployer::deploy() |
| 222 | { |
| 223 | if (!m_slssteamInstalled) { |
| 224 | m_statusMessage = "Cannot deploy: SLSsteam is not installed."; |
| 225 | emit statusMessageChanged(); |
| 226 | emit deployCompleted(false); |
| 227 | return false; |
| 228 | } |
| 229 | |
| 230 | if (!m_headcrabInstalled) { |
| 231 | m_statusMessage = "Failed to deploy. Did you run h3adcr-b first?"; |
| 232 | emit statusMessageChanged(); |
| 233 | emit deployCompleted(false); |
| 234 | return false; |
| 235 | } |
| 236 | |
| 237 | if (m_soSourcePath.isEmpty()) { |
| 238 | m_statusMessage = "Cannot deploy: cloud_redirect.so not found. Installation may be corrupted."; |
| 239 | emit statusMessageChanged(); |
| 240 | emit deployCompleted(false); |
| 241 | return false; |
| 242 | } |
| 243 | |
| 244 | if (!isElf32Bit(m_soSourcePath)) { |
| 245 | m_statusMessage = "Cannot deploy: cloud_redirect.so is not 32-bit, your compile is bad."; |
| 246 | emit statusMessageChanged(); |
| 247 | emit deployCompleted(false); |
| 248 | return false; |
| 249 | } |
| 250 | |
| 251 | QString crDir = crDataDir(); |
| 252 | QDir().mkpath(crDir); |
| 253 | |
| 254 | if (QFile::exists(m_soDeployPath)) { |
| 255 | if (!QFile::remove(m_soDeployPath)) { |
| 256 | m_statusMessage = "Failed to remove existing " + m_soDeployPath + " (file may be in use by Steam)"; |
| 257 | emit statusMessageChanged(); |
| 258 | emit deployCompleted(false); |
| 259 | return false; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | if (!QFile::copy(m_soSourcePath, m_soDeployPath)) { |
| 264 | m_statusMessage = "Failed to copy cloud_redirect.so to " + m_soDeployPath; |
| 265 | emit statusMessageChanged(); |
| 266 | emit deployCompleted(false); |
| 267 | return false; |
| 268 | } |
| 269 | |
| 270 | QFile::setPermissions(m_soDeployPath, |
| 271 | QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner | |
| 272 | QFileDevice::ReadGroup | QFileDevice::ExeGroup | |
| 273 | QFileDevice::ReadOther | QFileDevice::ExeOther); |
| 274 | |
| 275 | if (!m_cliSourcePath.isEmpty()) { |
| 276 | if (QFile::exists(m_cliDeployPath)) |
| 277 | QFile::remove(m_cliDeployPath); |
| 278 |
nothing calls this directly
no test coverage detected