summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/FileSpec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index 19f3b93f087..553764e560d 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -164,7 +164,20 @@ FileSpec::Resolve (llvm::SmallVectorImpl<char> &path)
ResolveUsername(path);
#endif // #ifdef LLDB_CONFIG_TILDE_RESOLVES_TO_USER
+ // Save a copy of the original path that's passed in
+ llvm::SmallString<PATH_MAX> original_path(path.begin(), path.end());
+
llvm::sys::fs::make_absolute(path);
+
+
+ path.push_back(0); // Be sure we have a nul terminated string
+ path.pop_back();
+ struct stat file_stats;
+ if (::stat (path.data(), &file_stats) != 0)
+ {
+ path.clear();
+ path.append(original_path.begin(), original_path.end());
+ }
}
FileSpec::FileSpec() :
OpenPOWER on IntegriCloud