| 439 | } |
| 440 | |
| 441 | bool cmFileCopier::Install(std::string const& fromFile, |
| 442 | std::string const& toFile) |
| 443 | { |
| 444 | if (fromFile.empty()) { |
| 445 | this->Status.SetError( |
| 446 | "INSTALL encountered an empty string input file name."); |
| 447 | return false; |
| 448 | } |
| 449 | |
| 450 | // Collect any properties matching this file name. |
| 451 | MatchProperties match_properties = this->CollectMatchProperties(fromFile); |
| 452 | |
| 453 | // Skip the file if it is excluded. |
| 454 | if (match_properties.Exclude) { |
| 455 | return true; |
| 456 | } |
| 457 | |
| 458 | if (cmSystemTools::SameFile(fromFile, toFile)) { |
| 459 | return true; |
| 460 | } |
| 461 | |
| 462 | std::string newFromFile = fromFile; |
| 463 | std::string newToFile = toFile; |
| 464 | |
| 465 | if (this->FollowSymlinkChain && |
| 466 | !this->InstallSymlinkChain(newFromFile, newToFile)) { |
| 467 | return false; |
| 468 | } |
| 469 | |
| 470 | if (cmSystemTools::FileIsSymlink(newFromFile)) { |
| 471 | return this->InstallSymlink(newFromFile, newToFile); |
| 472 | } |
| 473 | if (cmSystemTools::FileIsDirectory(newFromFile)) { |
| 474 | return this->InstallDirectory(newFromFile, newToFile, match_properties); |
| 475 | } |
| 476 | if (cmSystemTools::FileExists(newFromFile)) { |
| 477 | return this->InstallFile(newFromFile, newToFile, match_properties); |
| 478 | } |
| 479 | return this->ReportMissing(newFromFile); |
| 480 | } |
| 481 | |
| 482 | bool cmFileCopier::InstallSymlinkChain(std::string& fromFile, |
| 483 | std::string& toFile) |
no test coverage detected