def rebuild(view): folders = view.window().folders() if len(folders) > 0: for folder in folders: for lang in Setting.getSupportedLanguages(): cTagsBinary = None if os.path.exists('/usr/bin/ctags'): cTagsBinary = '/usr/bin/ctags' if os.path.exists('/opt/local/bin/ctags'): cTagsBinary = '/opt/local/bin/ctags' if cTagsBinary is None: raise CTagsException('YAC: ctags binary not found') cTagsFile = os.path.join(folder, '.tags' + lang) if os.path.exists(cTagsFile): os.remove(cTagsFile) cmd = cTagsBinary + ' -R --languages=' + lang + ' -f "' + cTagsFile + '" "' + folder + '"' os.popen(cmd) else: raise CTagsException('No folders detected')
def test_aaa_createCTagsFile(self): CTags.rebuild(self.view) for lang in Setting.getSupportedLanguages(): self.assertEqual(os.path.exists(os.path.join(Setting.getResourcesPath(), '.tags' + lang)), True)