192 Public method to get a list of installed API files. |
193 Public method to get a list of installed API files. |
193 |
194 |
194 @return list of installed API files (list of strings) |
195 @return list of installed API files (list of strings) |
195 """ |
196 """ |
196 if self.__apis is not None: |
197 if self.__apis is not None: |
197 if Globals.isWindowsPlatform(): |
198 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) |
198 qsciPath = os.path.join(Globals.getPyQt6ModulesDirectory(), "qsci") |
199 apisDir = os.path.join(qtDataDir, "qsci", "api") |
199 if os.path.exists(qsciPath): |
200 if os.path.exists(apisDir): |
200 # it's the installer |
201 if self.__lexer.language(): |
201 if self.__lexer.lexerName() is not None: |
202 apiDir = os.path.join(apisDir, self.__lexer.language()) |
202 apidir = os.path.join(qsciPath, "api", self.__lexer.lexerName()) |
203 if not os.path.exists(apiDir): |
203 fnames = [] |
204 # use lower case language |
204 filist = QDir(apidir).entryInfoList( |
205 apiDir = os.path.join(apisDir, self.__lexer.language().lower()) |
205 ["*.api"], QDir.Filter.Files, QDir.SortFlag.IgnoreCase |
206 fnames = { |
|
207 os.path.join(apiDir, f) |
|
208 for f in glob.glob("*.api", root_dir=apiDir) |
|
209 } |
|
210 # combine with the QScintilla standard behavior |
|
211 fnames |= { |
|
212 os.path.join(apiDir, f) |
|
213 for f in glob.glob( |
|
214 "*.api", |
|
215 root_dir=os.path.join(apisDir, self.__lexer.lexer()), |
206 ) |
216 ) |
207 for fi in filist: |
217 } |
208 fnames.append(fi.absoluteFilePath()) |
218 return sorted(fnames) |
209 return fnames |
219 else: |
210 else: |
220 return [] |
211 return [] |
|
212 |
|
213 return self.__apis.installedAPIFiles() |
|
214 else: |
221 else: |
215 return [] |
222 return [] |
216 |
223 |
217 def __preparedName(self): |
224 def __preparedName(self): |
218 """ |
225 """ |