summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-05-05 14:29:27 (GMT)
committerBrad King <brad.king@kitware.com>2006-05-05 14:29:27 (GMT)
commit523d9ebeed37fe256afb292de2f20f093eb873d1 (patch)
treefdec5345f35b207887a7d89df101fdb8ce3ef136 /Source/kwsys/SystemTools.cxx
parent6b9f681f911e15d1930d5c2735a73c95c8f837e5 (diff)
downloadCMake-523d9ebeed37fe256afb292de2f20f093eb873d1.zip
CMake-523d9ebeed37fe256afb292de2f20f093eb873d1.tar.gz
CMake-523d9ebeed37fe256afb292de2f20f093eb873d1.tar.bz2
ENH: Added always/if-different option to CopyADirectory. Added CopyAFile with the same interface.
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx23
1 files changed, 20 insertions, 3 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 89ccd6d..1a878d5 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1637,11 +1637,26 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
return true;
}
+//----------------------------------------------------------------------------
+bool SystemTools::CopyAFile(const char* source, const char* destination,
+ bool always)
+{
+ if(always)
+ {
+ return SystemTools::CopyFileAlways(source, destination);
+ }
+ else
+ {
+ return SystemTools::CopyFileIfDifferent(source, destination);
+ }
+}
+
/**
* Copy a directory content from "source" directory to the directory named by
* "destination".
*/
-bool SystemTools::CopyADirectory(const char* source, const char* destination)
+bool SystemTools::CopyADirectory(const char* source, const char* destination,
+ bool always)
{
Directory dir;
dir.Load(source);
@@ -1663,14 +1678,16 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination)
kwsys_stl::string fullDestPath = destination;
fullDestPath += "/";
fullDestPath += dir.GetFile(static_cast<unsigned long>(fileNum));
- if (!SystemTools::CopyADirectory(fullPath.c_str(), fullDestPath.c_str()))
+ if (!SystemTools::CopyADirectory(fullPath.c_str(),
+ fullDestPath.c_str(),
+ always))
{
return false;
}
}
else
{
- if(!SystemTools::CopyFileAlways(fullPath.c_str(), destination))
+ if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always))
{
return false;
}