Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Fitch
KWSys
Commits
55bb42d9
Commit
55bb42d9
authored
18 years ago
by
Brad King
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Added always/if-different option to CopyADirectory. Added CopyAFile with the same interface.
parent
4a6006a8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SystemTools.cxx
+20
-3
20 additions, 3 deletions
SystemTools.cxx
SystemTools.hxx.in
+14
-3
14 additions, 3 deletions
SystemTools.hxx.in
with
34 additions
and
6 deletions
SystemTools.cxx
+
20
−
3
View file @
55bb42d9
...
...
@@ -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
::
CopyFile
Always
(
fullPath
.
c_str
(),
destination
))
if
(
!
SystemTools
::
Copy
A
File
(
fullPath
.
c_str
(),
destination
,
always
))
{
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
SystemTools.hxx.in
+
14
−
3
View file @
55bb42d9
...
...
@@ -469,10 +469,21 @@ public:
static bool CopyFileAlways(const char* source, const char* destination);
/**
* Copy content directory to another directory with all files and
* subdirectories
* 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 bool CopyADirectory(const char* source, const char* destination);
static bool CopyAFile(const char* source, const char* destination,
bool always = true);
/**
* Copy content directory to another directory with all files and
* subdirectories. If the "always" argument is true all files are
* always copied. If it is false, only files that have changed or
* are new are copied.
*/
static bool CopyADirectory(const char* source, const char* destination,
bool always = true);
/**
* Remove a file
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment