| 916 | } |
| 917 | |
| 918 | bool HandleTouchImpl(std::vector<std::string> const& args, bool create, |
| 919 | cmExecutionStatus& status) |
| 920 | { |
| 921 | // Projects might pass a dynamically generated list of files, and it |
| 922 | // could be an empty list. We should not assume there is at least one. |
| 923 | |
| 924 | for (std::string const& arg : |
| 925 | cmMakeRange(args).advance(1)) // Get rid of subcommand |
| 926 | { |
| 927 | std::string tfile = arg; |
| 928 | if (!cmsys::SystemTools::FileIsFullPath(tfile)) { |
| 929 | tfile = |
| 930 | cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', arg); |
| 931 | } |
| 932 | if (!status.GetMakefile().CanIWriteThisFile(tfile)) { |
| 933 | std::string e = cmStrCat("attempted to touch a file: ", tfile, |
| 934 | " in a source directory."); |
| 935 | status.SetError(e); |
| 936 | cmSystemTools::SetFatalErrorOccurred(); |
| 937 | return false; |
| 938 | } |
| 939 | if (!cmSystemTools::Touch(tfile, create)) { |
| 940 | std::string error = "problem touching file: " + tfile; |
| 941 | status.SetError(error); |
| 942 | return false; |
| 943 | } |
| 944 | } |
| 945 | return true; |
| 946 | } |
| 947 | |
| 948 | bool HandleTouchCommand(std::vector<std::string> const& args, |
| 949 | cmExecutionStatus& status) |
no test coverage detected
searching dependent graphs…