summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileUtil.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2017-08-23 11:14:01 +0200
committerGitHub <noreply@github.com>2017-08-23 11:14:01 +0200
commit187e65f495ccd07e8f19573bab5fa21f88e535f1 (patch)
treeb82a1b56232e1a73adc683907a63d3ea5d221a52 /Source/Core/Common/FileUtil.cpp
parent24e919a26c39e76fdd3c66b8faf0847f322cf208 (diff)
parentef888ef16846fc946cc6ed52a934999a407ea095 (diff)
Merge pull request #5941 from delroth/wfs
WFS updates
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
-rw-r--r--Source/Core/Common/FileUtil.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index 725d5134c5..84647fd4e9 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -521,7 +521,7 @@ bool DeleteDirRecursively(const std::string& directory)
}
// Create directory and copy contents (does not overwrite existing files)
-void CopyDir(const std::string& source_path, const std::string& dest_path)
+void CopyDir(const std::string& source_path, const std::string& dest_path, bool destructive)
{
if (source_path == dest_path)
return;
@@ -562,10 +562,16 @@ void CopyDir(const std::string& source_path, const std::string& dest_path)
{
if (!Exists(dest))
File::CreateFullPath(dest + DIR_SEP);
- CopyDir(source, dest);
+ CopyDir(source, dest, destructive);
+ }
+ else if (!Exists(dest) && !destructive)
+ {
+ Copy(source, dest);
+ }
+ else
+ {
+ Rename(source, dest);
}
- else if (!Exists(dest))
- File::Copy(source, dest);
#ifdef _WIN32
} while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);