diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2021-02-25 13:55:32 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2021-02-26 08:55:51 +0100 |
commit | 17b61cbd8179783cbb0108422fb2e2d60d3e9548 (patch) | |
tree | 7b96ff608e999a98b18d9b36f6a2793b047b447c /bin/gbuild-to-ide | |
parent | 21a8653f6a94ca4c6de8160249e721690a679193 (diff) |
qtcreator: Simplify adding of file extension
Create a new method 'get_file_path' which basically
does what 'get_header_extension' and 'get_source_extension'
did, but already concatenates the extension to the
input; call that one and rename other methods accordingly.
While at it, let 'get_source_extension' search for files
in srcdir instead of builddir, as another step in making
generation of qtcreator-ide-integration work properly for
the case where srcdir != builddir.
Change-Id: I1e34bfdb726192b4af21e9003205fa551545ae31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111551
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'bin/gbuild-to-ide')
-rwxr-xr-x | bin/gbuild-to-ide | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index cc779a37158a..3ee79977e78f 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -1635,19 +1635,19 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator): </qtcreator> """ - def get_source_extension(self, src_file): - path = os.path.join(self.base_folder, src_file) - for ext in (".cxx", ".cpp", ".c", ".mm"): - if os.path.isfile(path + ext): - return ext + def get_file_path(self, src_file, ext_choices): + path = os.path.join(self.gbuildparser.srcdir, src_file) + for ext in ext_choices: + full_path = path + ext + if os.path.isfile(full_path): + return full_path return "" - def get_header_extension(self, src_file): - path = os.path.join(self.base_folder, src_file) - for ext in (".hxx", ".hpp", ".h"): - if os.path.isfile(path + ext): - return ext - return "" + def get_source_path(self, src_file): + return self.get_file_path(src_file, (".cxx", ".cpp", ".c", ".mm")) + + def get_header_path(self, src_file): + return self.get_file_path(src_file, (".hxx", ".hpp", ".h")) def build_data_libs(self): @@ -1682,14 +1682,14 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator): for file_ in lib.cxxobjects: # the file has no extension : search it # self._log("\n file : %s" % file_) - ext = self.get_source_extension(file_) - if ext: - sources_list.append(lopath(file_ + ext)) + path = self.get_source_path(file_) + if path: + sources_list.append(lopath(path)) # few cxxobject files have a header beside - ext = self.get_header_extension(file_) - if ext: - headers_list.append(lopath(file_ + ext)) + path = self.get_header_path(file_) + if path: + headers_list.append(lopath(path)) cxxflags_list = [] for cxxflag in lib.cxxflags: |