-
Notifications
You must be signed in to change notification settings - Fork 5
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
Auto detect bundle id with code #4
Comments
第一个方案我之前试过了,是不行的。 |
因为取色器启动的时候是以子进程方式启动的,而它自己并不是一个所谓的Bundle。而且往上找父进程的方式呢,又是不稳定的,比方说,我从terminal里面启动electron里面的取色器,权限实际上是需要terminal的,而不是electron的;但是进程树里面找到的第一个父进程是electron的。 |
比如说这个我在terminal里面启动的例子,取色器最终会作为一个Electron Helper(就是图中蓝色高亮的那个)进程的子进程运行。而 |
把规则改为 |
😂我感觉太复杂了,我们还是在REAME里面加上个提醒吧 |
确定id的时候用这条命令吧,cat XXXXXX.app/Contents/Info.plist | grep -A1 Identifie。 |
grep 的时候-A1指定打印出来下一行,然后匹配Identifie就行了。 |
这个逻辑用 node 也是可以做的,提在这边是考虑到 objC 可能有 Apple 提供的接口会在整合度和效率上好一些 我在 electron-color-picker 先用 |
嗯,我当初也是觉得要是可以自动找就好了,然后各种方法都试了,结论就是还是在脚本语言里面处理以下就好了😂,objC有点小麻烦而且还不确定好使。 |
@ThatBean 优秀!!我参考一下!! |
Found 2 possible candidate:
[[NSBundle mainBundle] bundleIdentifier]
https://stackoverflow.com/questions/8883102/obtain-bundle-identifier-programmatically
[[NSWorkspace sharedWorkspace] runningApplications]
https://stackoverflow.com/questions/8348627/what-is-the-correct-way-to-identify-the-currently-active-application-in-osx-10
The ideal scenario is:
This way the required extra
--bundle-id=*
param can be removed for--mode-2
The text was updated successfully, but these errors were encountered: