diff options
author | Brad King <brad.king@kitware.com> | 2019-08-09 14:33:20 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-08-09 14:39:36 (GMT) |
commit | 1996e0157826903f27f73825a01f83d53dc8fba4 (patch) | |
tree | 12d2eb3281aeddc58a748007b05e5013fd430ed3 /Source/cmFileCopier.cxx | |
parent | 1263b0884bbad60b4f21d70a59a11647d30d54a8 (diff) | |
parent | a7a5f376bcd7465c888801251e4f0175ef3a1c36 (diff) | |
download | CMake-1996e0157826903f27f73825a01f83d53dc8fba4.zip CMake-1996e0157826903f27f73825a01f83d53dc8fba4.tar.gz CMake-1996e0157826903f27f73825a01f83d53dc8fba4.tar.bz2 |
Merge topic 'cmFileCommand-refactoring'
a7a5f376bc cmFileCommand: Use cmSubcommandTable
b66b7464ab Introduce cmSubcommandTable
2b785875fb cmFileCommand: turn into free function
9703c65718 cmFileCommand: put subcommands in unnamed namespace
64f987c174 cmFileCommand: port to cmExecutionStatus
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3657
Diffstat (limited to 'Source/cmFileCopier.cxx')
-rw-r--r-- | Source/cmFileCopier.cxx | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx index 71493bb..62f132d 100644 --- a/Source/cmFileCopier.cxx +++ b/Source/cmFileCopier.cxx @@ -3,8 +3,8 @@ #include "cmFileCopier.h" +#include "cmExecutionStatus.h" #include "cmFSPermissions.h" -#include "cmFileCommand.h" #include "cmFileTimes.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" @@ -21,9 +21,9 @@ using namespace cmFSPermissions; -cmFileCopier::cmFileCopier(cmFileCommand* command, const char* name) - : FileCommand(command) - , Makefile(command->GetMakefile()) +cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name) + : Status(status) + , Makefile(&status.GetMakefile()) , Name(name) , Always(false) , MatchlessFiles(true) @@ -92,7 +92,7 @@ bool cmFileCopier::SetPermissions(const std::string& toFile, if (!cmSystemTools::SetPermissions(toFile, permissions)) { std::ostringstream e; e << this->Name << " cannot set permissions on \"" << toFile << "\""; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } } @@ -106,7 +106,7 @@ bool cmFileCopier::CheckPermissions(std::string const& arg, if (!cmFSPermissions::stringToModeT(arg, permissions)) { std::ostringstream e; e << this->Name << " given invalid permission \"" << arg << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } return true; @@ -122,7 +122,7 @@ bool cmFileCopier::ReportMissing(const std::string& fromFile) // The input file does not exist and installation is not optional. std::ostringstream e; e << this->Name << " cannot find \"" << fromFile << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } @@ -130,7 +130,7 @@ void cmFileCopier::NotBeforeMatch(std::string const& arg) { std::ostringstream e; e << "option " << arg << " may not appear before PATTERN or REGEX."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); this->Doing = DoingError; } @@ -138,7 +138,7 @@ void cmFileCopier::NotAfterMatch(std::string const& arg) { std::ostringstream e; e << "option " << arg << " may not appear after PATTERN or REGEX."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); this->Doing = DoingError; } @@ -175,7 +175,7 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode) cmSystemTools::ExpandListArgument(default_dir_install_permissions, items); for (const auto& arg : items) { if (!this->CheckPermissions(arg, **mode)) { - this->FileCommand->SetError( + this->Status.SetError( " Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS variable."); return false; } @@ -195,7 +195,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args) if (!this->CheckKeyword(args[i]) && !this->CheckValue(args[i])) { std::ostringstream e; e << "called with unknown argument \"" << args[i] << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } @@ -209,7 +209,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args) if (this->Destination.empty()) { std::ostringstream e; e << this->Name << " given no DESTINATION"; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } @@ -342,7 +342,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) } else { std::ostringstream e; e << "could not compile PATTERN \"" << arg << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); this->Doing = DoingError; } } break; @@ -354,7 +354,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) } else { std::ostringstream e; e << "could not compile REGEX \"" << arg << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); this->Doing = DoingError; } break; @@ -397,8 +397,8 @@ bool cmFileCopier::Run(std::vector<std::string> const& args) file += "/"; file += f; } else if (!this->FilesFromDir.empty()) { - this->FileCommand->SetError("option FILES_FROM_DIR requires all files " - "to be specified as relative paths."); + this->Status.SetError("option FILES_FROM_DIR requires all files " + "to be specified as relative paths."); return false; } else { file = f; @@ -447,7 +447,7 @@ bool cmFileCopier::Install(const std::string& fromFile, if (fromFile.empty()) { std::ostringstream e; e << "INSTALL encountered an empty string input file name."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } @@ -515,7 +515,7 @@ bool cmFileCopier::InstallSymlinkChain(std::string& fromFile, if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) { std::ostringstream e; e << this->Name << " cannot create symlink \"" << toFile << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } } @@ -536,7 +536,7 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile, std::ostringstream e; e << this->Name << " cannot read symlink \"" << fromFile << "\" to duplicate at \"" << toFile << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } @@ -567,7 +567,7 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile, std::ostringstream e; e << this->Name << " cannot duplicate symlink \"" << fromFile << "\" at \"" << toFile << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } } @@ -596,7 +596,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile, std::ostringstream e; e << this->Name << " cannot copy file \"" << fromFile << "\" to \"" << toFile << "\"."; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } @@ -612,7 +612,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile, std::ostringstream e; e << this->Name << " cannot set modification time on \"" << toFile << "\""; - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } } @@ -649,7 +649,7 @@ bool cmFileCopier::InstallDirectory(const std::string& source, std::ostringstream e; e << this->Name << " cannot make directory \"" << destination << "\": " << cmSystemTools::GetLastSystemError(); - this->FileCommand->SetError(e.str()); + this->Status.SetError(e.str()); return false; } |