summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r--lldb/source/Target/Platform.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index acafa8b35c5..ac8a168b93e 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -696,7 +696,8 @@ Error Platform::Install(const FileSpec &src, const FileSpec &dst) {
namespace fs = llvm::sys::fs;
switch (fs::get_file_type(src.GetPath(), false)) {
case fs::file_type::directory_file: {
- llvm::sys::fs::remove(fixed_dst.GetPath());
+ if (GetFileExists(fixed_dst))
+ Unlink(fixed_dst);
uint32_t permissions = src.GetPermissions();
if (permissions == 0)
permissions = eFilePermissionsDirectoryDefault;
@@ -715,12 +716,14 @@ Error Platform::Install(const FileSpec &src, const FileSpec &dst) {
} break;
case fs::file_type::regular_file:
- llvm::sys::fs::remove(fixed_dst.GetPath());
+ if (GetFileExists(fixed_dst))
+ Unlink(fixed_dst);
error = PutFile(src, fixed_dst);
break;
case fs::file_type::symlink_file: {
- llvm::sys::fs::remove(fixed_dst.GetPath());
+ if (GetFileExists(fixed_dst))
+ Unlink(fixed_dst);
FileSpec src_resolved;
error = FileSystem::Readlink(src, src_resolved);
if (error.Success())
OpenPOWER on IntegriCloud