From a59ed8fa86036efe66efcaddd5cd3e1d17856563 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Fri, 18 Nov 2022 19:27:41 -0800 Subject: [PATCH] [lldb] Fix SBFileSpec.fullpath Reimplement `SBFileSpec.fullpath` to (indirectly) use `FileSpec::GetPath`. Instead of hardcoding a `/` separator, use `GetPath`. This makes use of the `FileSpec`'s internal style, which for example allows for backslash on Windows where required. It's not obvious from looking at the source, but the `fullpath` property is implemented with `str`, which calls `GetDescription`, which finally calls `GetPath`. Differential Revision: https://reviews.llvm.org/D138348 --- lldb/bindings/interface/SBFileSpec.i | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/lldb/bindings/interface/SBFileSpec.i b/lldb/bindings/interface/SBFileSpec.i index b549321..e6f9bb8 100644 --- a/lldb/bindings/interface/SBFileSpec.i +++ b/lldb/bindings/interface/SBFileSpec.i @@ -84,18 +84,7 @@ public: #ifdef SWIGPYTHON %pythoncode %{ - def __get_fullpath__(self): - spec_dir = self.GetDirectory() - spec_file = self.GetFilename() - if spec_dir and spec_file: - return '%s/%s' % (spec_dir, spec_file) - elif spec_dir: - return spec_dir - elif spec_file: - return spec_file - return None - - fullpath = property(__get_fullpath__, None, doc='''A read only property that returns the fullpath as a python string.''') + fullpath = property(str, None, doc='''A read only property that returns the fullpath as a python string.''') basename = property(GetFilename, None, doc='''A read only property that returns the path basename as a python string.''') dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''') exists = property(Exists, None, doc='''A read only property that returns a boolean value that indicates if the file exists.''') -- 2.7.4