Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]webui中是否能增加获取当前模块根目录的功能 #1571

Open
Greyh4t opened this issue Mar 31, 2024 · 4 comments
Open

[Feature]webui中是否能增加获取当前模块根目录的功能 #1571

Greyh4t opened this issue Mar 31, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@Greyh4t
Copy link

Greyh4t commented Mar 31, 2024

Is your feature request related to a problem? Please describe.

模块内置了一些二进制文件,需要通过exec调用,只能写死二进制的绝对路径,如果模块改了id,代码也得改

Describe the solution you'd like.

webui提供了执行命令的功能,那相应的有些操作可能会涉及到该模块目录下的文件,我试了一下目前命令默认的cwd是 /,涉及到模块目录下的文件只能写死绝对路径,是不是能提供一个方法能够在js中直接获取模块根目录,或者执行命令的cwd默认设置为模块根目录?

Describe alternatives you've considered.

在js的kernelsu模块中提供一个moddir方法,或者exec命令默认的cwd设置为moddir

Additional context

No response

@Ylarod
Copy link
Collaborator

Ylarod commented Apr 2, 2024

为啥会有修改模块id的需求?

@Greyh4t
Copy link
Author

Greyh4t commented Apr 2, 2024

为啥会有修改模块id的需求?

重点不是修改模块id的需求,重点是模块的根目录应该是一个固定的变量,开发的时候不需要考虑这个,只需要引用变量就好了。

这样相关的代码不管是改id还是移植都很方便,模块的脚本中提供了类似的变量,webui中也应该提供这样的功能,否则得先搞明白模块安装后根目录在 /data/adb/modules/<modid> ,再写死路径。

这样并不优雅,而且如果因为系统原因或者kernelsu自身的原因模块安装路径不在这里了,那之前所有写死路径的模块都会有兼容性问题

@Ylarod Ylarod added the enhancement New feature or request label Apr 2, 2024
@fsxitutu
Copy link
Contributor

如果你只是想要模块的安装目录的话可以用mount命令获取到所有挂载点的挂载参数,其中/system挂载点的挂载参数里的lowerdir字段包括各个模块中system目录的绝对路径。如果你知道模块id的话使用js的字符串对象方法很容易就能找到模块的安装路径或者自己拼接出安装路径

@tiann
Copy link
Owner

tiann commented Apr 25, 2024

我认为这个接口是有必要的,加起来也不麻烦的;有兴趣的可以试着提个 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants