diff options
author | Brad King <brad.king@kitware.com> | 2022-11-15 14:28:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-11-15 14:28:34 (GMT) |
commit | 91dd7898ee6f6e38e55430bbb55fd5db851671e9 (patch) | |
tree | fe31f1f674dfeeaf7af3e0196f7c27178a021732 /Source/kwsys/SystemTools.hxx.in | |
parent | 0ebee2a14bf1dbd8e1f5fd4a8d114906d559518f (diff) | |
parent | a9c659b1b6165b1bf2729fec5b0b929a9f2db078 (diff) | |
download | CMake-91dd7898ee6f6e38e55430bbb55fd5db851671e9.zip CMake-91dd7898ee6f6e38e55430bbb55fd5db851671e9.tar.gz CMake-91dd7898ee6f6e38e55430bbb55fd5db851671e9.tar.bz2 |
Merge branch 'upstream-KWSys' into file-copy-error-path
# By KWSys Upstream
* upstream-KWSys:
KWSys 2022-11-15 (6c92b9b0)
Diffstat (limited to 'Source/kwsys/SystemTools.hxx.in')
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index acce015..56b65fd 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -566,11 +566,34 @@ public: const mode_t* mode = nullptr); /** + * Represent the result of a file copy operation. + * This is the result 'Status' and, if the operation failed, + * an indication of whether the error occurred on the source + * or destination path. + */ + struct CopyStatus : public Status + { + enum WhichPath + { + NoPath, + SourcePath, + DestPath, + }; + CopyStatus() = default; + CopyStatus(Status s, WhichPath p) + : Status(s) + , Path(p) + { + } + WhichPath Path = NoPath; + }; + + /** * Copy the source file to the destination file only * if the two files differ. */ - static Status CopyFileIfDifferent(std::string const& source, - std::string const& destination); + static CopyStatus CopyFileIfDifferent(std::string const& source, + std::string const& destination); /** * Compare the contents of two files. Return true if different @@ -588,13 +611,13 @@ public: /** * Blockwise copy source to destination file */ - static Status CopyFileContentBlockwise(std::string const& source, - std::string const& destination); + static CopyStatus CopyFileContentBlockwise(std::string const& source, + std::string const& destination); /** * Clone the source file to the destination file */ - static Status CloneFileContent(std::string const& source, - std::string const& destination); + static CopyStatus CloneFileContent(std::string const& source, + std::string const& destination); /** * Return true if the two files are the same file @@ -604,16 +627,17 @@ public: /** * Copy a file. */ - static Status CopyFileAlways(std::string const& source, - std::string const& destination); + static CopyStatus CopyFileAlways(std::string const& source, + std::string const& destination); /** * Copy a file. If the "always" argument is true the file is always * copied. If it is false, the file is copied only if it is new or * has changed. */ - static Status CopyAFile(std::string const& source, - std::string const& destination, bool always = true); + static CopyStatus CopyAFile(std::string const& source, + std::string const& destination, + bool always = true); /** * Copy content directory to another directory with all files and |