diff options
author | Zachary Turner <zturner@google.com> | 2014-12-06 00:14:24 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-12-06 00:14:24 +0000 |
commit | 00cdc98b7f58149577fee51acccf540f2742b62b (patch) | |
tree | 2740fe6133d5939388108912048a922dcc1294f7 /lldb/source/Host/common/FileSpec.cpp | |
parent | 3464e321b84c447f81a7856f0423ad073b025a3a (diff) | |
download | bcm5719-llvm-00cdc98b7f58149577fee51acccf540f2742b62b.tar.gz bcm5719-llvm-00cdc98b7f58149577fee51acccf540f2742b62b.zip |
Fix some posix assumptions related to running shell commands.
Differential Revision: http://reviews.llvm.org/D6553
Reviewed By: Greg Clayton
llvm-svn: 223548
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r-- | lldb/source/Host/common/FileSpec.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp index 7cd7729f4c3..0af0556d30c 100644 --- a/lldb/source/Host/common/FileSpec.cpp +++ b/lldb/source/Host/common/FileSpec.cpp @@ -1340,18 +1340,31 @@ FileSpec::IsSourceImplementationFile () const bool FileSpec::IsRelativeToCurrentWorkingDirectory () const { - const char *directory = m_directory.GetCString(); - if (directory && directory[0]) + const char *dir = m_directory.GetCString(); + llvm::StringRef directory(dir ? dir : ""); + + if (directory.size() > 0) { - // If the path doesn't start with '/' or '~', return true - switch (directory[0]) + if (m_syntax == ePathSyntaxWindows) { - case '/': - case '~': - return false; - default: + if (directory.size() >= 2 && directory[1] == ':') + return false; + if (directory[0] == '/') + return false; return true; } + else + { + // If the path doesn't start with '/' or '~', return true + switch (directory[0]) + { + case '/': + case '~': + return false; + default: + return true; + } + } } else if (m_filename) { |