def get_plugins_list():
'''
Load plugin lists, including both built-in and 3rd-party plugins
'''
ret = {} # app_name->(path,with_UI)
APP_DIR = os.path.join(
str(current_activity.getFilesDir().getAbsolutePath()), "app/plugins")
l = os.listdir(APP_DIR)
for f in l:
if os.path.exists(os.path.join(APP_DIR, f, "main.mi2app")):
# ret.append(f)
ret[f] = (os.path.join(APP_DIR, f), False)
# Yuanjie: support alternative path for users to customize their own plugin
APP_DIR = main_utils.get_mobileinsight_plugin_path()
if os.path.exists(APP_DIR):
l = os.listdir(APP_DIR)
for f in l:
if os.path.exists(os.path.join(APP_DIR, f, "main_ui.mi2app")):
if f in ret:
tmp_name = f + " (plugin)"
else:
tmp_name = f
ret[tmp_name] = (os.path.join(APP_DIR, f), True)
elif os.path.exists(os.path.join(APP_DIR, f, "main.mi2app")):
if f in ret:
tmp_name = f + " (plugin)"
else:
tmp_name = f
ret[tmp_name] = (os.path.join(APP_DIR, f), False)
else: # create directory for user-customized apps
create_folder()
return ret
评论列表
文章目录