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.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index c0efa71aad1..65d6543c86e 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -243,7 +243,17 @@ FileSpec::FileSpec(const char *pathname, bool resolve_path, PathSyntax syntax) :
}
FileSpec::FileSpec(const char *pathname, bool resolve_path, ArchSpec arch) :
- FileSpec(pathname, resolve_path, arch.GetTriple().isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix)
+ FileSpec{pathname, resolve_path, arch.GetTriple().isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix}
+{
+}
+
+FileSpec::FileSpec(const std::string &path, bool resolve_path, PathSyntax syntax) :
+ FileSpec{path.c_str(), resolve_path, syntax}
+{
+}
+
+FileSpec::FileSpec(const std::string &path, bool resolve_path, ArchSpec arch) :
+ FileSpec{path.c_str(), resolve_path, arch}
{
}
@@ -334,6 +344,12 @@ FileSpec::SetFile (const char *pathname, bool resolve, PathSyntax syntax)
m_directory.SetCString(normalized.c_str());
}
+void
+FileSpec::SetFile(const std::string &pathname, bool resolve, PathSyntax syntax)
+{
+ return SetFile(pathname.c_str(), resolve, syntax);
+}
+
//----------------------------------------------------------------------
// Convert to pointer operator. This allows code to check any FileSpec
// objects to see if they contain anything valid using code such as:
@@ -755,7 +771,7 @@ FileSpec::GetPermissions () const
{
uint32_t file_permissions = 0;
if (*this)
- FileSystem::GetFilePermissions(GetPath().c_str(), file_permissions);
+ FileSystem::GetFilePermissions(*this, file_permissions);
return file_permissions;
}
@@ -829,6 +845,12 @@ FileSpec::GetPath(bool denormalize) const
return std::string(result.begin(), result.end());
}
+const char *
+FileSpec::GetCString(bool denormalize) const
+{
+ return ConstString{GetPath(denormalize)}.AsCString(NULL);
+}
+
void
FileSpec::GetPath(llvm::SmallVectorImpl<char> &path, bool denormalize) const
{
@@ -1336,6 +1358,12 @@ FileSpec::AppendPathComponent (const char *new_path)
}
void
+FileSpec::AppendPathComponent(const std::string &new_path)
+{
+ return AppendPathComponent(new_path.c_str());
+}
+
+void
FileSpec::RemoveLastPathComponent ()
{
const bool resolve = false;
OpenPOWER on IntegriCloud