[lldb] Fix SBFileSpec.fullpath for Windows
Fix `fullpath` to not assume a `/` path separator. This was discovered when D133130 failed on Windows. Use `os.path.join()` to fix the issue. Reviewed By: mib Differential Revision: https://reviews.llvm.org/D133366
This commit is contained in:
@@ -88,7 +88,7 @@ public:
|
||||
spec_dir = self.GetDirectory()
|
||||
spec_file = self.GetFilename()
|
||||
if spec_dir and spec_file:
|
||||
return '%s/%s' % (spec_dir, spec_file)
|
||||
return os.path.join(spec_dir, spec_file)
|
||||
elif spec_dir:
|
||||
return spec_dir
|
||||
elif spec_file:
|
||||
|
||||
15
lldb/test/API/python_api/file_spec/TestFileSpecAPI.py
Normal file
15
lldb/test/API/python_api/file_spec/TestFileSpecAPI.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import lldb
|
||||
import os
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
|
||||
|
||||
class TestCase(TestBase):
|
||||
NO_DEBUG_INFO_TESTCASE = True
|
||||
|
||||
def test_full_path(self):
|
||||
file_spec = lldb.SBFileSpec()
|
||||
file_spec.SetDirectory("a")
|
||||
file_spec.SetFilename("b")
|
||||
self.assertEqual(file_spec.fullpath, os.path.join("a", "b"))
|
||||
Reference in New Issue
Block a user