summaryrefslogtreecommitdiff
path: root/source/API/SBFileSpec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBFileSpec.cpp')
-rw-r--r--source/API/SBFileSpec.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 011b88225ef9..f136409d0b68 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -7,11 +7,12 @@
//
//===----------------------------------------------------------------------===//
-#include <inttypes.h> // PRIu64
+#include <inttypes.h>
#include <limits.h>
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBStream.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/PosixApi.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
@@ -31,11 +32,15 @@ SBFileSpec::SBFileSpec(const lldb_private::FileSpec &fspec)
: m_opaque_ap(new lldb_private::FileSpec(fspec)) {}
// Deprecated!!!
-SBFileSpec::SBFileSpec(const char *path)
- : m_opaque_ap(new FileSpec(path, true)) {}
+SBFileSpec::SBFileSpec(const char *path) : m_opaque_ap(new FileSpec(path)) {
+ FileSystem::Instance().Resolve(*m_opaque_ap);
+}
SBFileSpec::SBFileSpec(const char *path, bool resolve)
- : m_opaque_ap(new FileSpec(path, resolve)) {}
+ : m_opaque_ap(new FileSpec(path)) {
+ if (resolve)
+ FileSystem::Instance().Resolve(*m_opaque_ap);
+}
SBFileSpec::~SBFileSpec() {}
@@ -50,7 +55,7 @@ bool SBFileSpec::IsValid() const { return m_opaque_ap->operator bool(); }
bool SBFileSpec::Exists() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- bool result = m_opaque_ap->Exists();
+ bool result = FileSystem::Instance().Exists(*m_opaque_ap);
if (log)
log->Printf("SBFileSpec(%p)::Exists () => %s",
@@ -61,13 +66,13 @@ bool SBFileSpec::Exists() const {
}
bool SBFileSpec::ResolveExecutableLocation() {
- return m_opaque_ap->ResolveExecutableLocation();
+ return FileSystem::Instance().ResolveExecutableLocation(*m_opaque_ap);
}
int SBFileSpec::ResolvePath(const char *src_path, char *dst_path,
size_t dst_len) {
llvm::SmallString<64> result(src_path);
- lldb_private::FileSpec::Resolve(result);
+ FileSystem::Instance().Resolve(result);
::snprintf(dst_path, dst_len, "%s", result.c_str());
return std::min(dst_len - 1, result.size());
}
@@ -143,12 +148,10 @@ const lldb_private::FileSpec *SBFileSpec::get() const {
}
const lldb_private::FileSpec &SBFileSpec::operator*() const {
- return *m_opaque_ap.get();
+ return *m_opaque_ap;
}
-const lldb_private::FileSpec &SBFileSpec::ref() const {
- return *m_opaque_ap.get();
-}
+const lldb_private::FileSpec &SBFileSpec::ref() const { return *m_opaque_ap; }
void SBFileSpec::SetFileSpec(const lldb_private::FileSpec &fs) {
*m_opaque_ap = fs;