如何让我的 gem 在安装时将 .dll 放入系统路径中的文件夹中?
...当然,并在卸载时将其删除。
问题是从我的 gem 调用的其他程序需要能够在系统 PATH 中找到某个文件 - 以编程方式设置 PATH 不起作用,因为这些程序正在以一种获得新环境的方式被调用。
我尝试将这些 .dll 文件作为 gemspec 中的“可执行文件”包含在内,但这似乎只会在 {ruby}/bin
文件夹中获得一些符号链接类型文件,这会导致错误,因为有问题的程序是期待实际的 .dll。
事实上,我只是在自述文件中添加了一条注释,要求人们手动将 .dll 文件复制到 PATH 中的文件夹中,但似乎应该有更好的方法来执行此操作。
任何帮助将不胜感激 - 谢谢!
... and remove it upon un-installation, of course.
The issue is that other programs being called from my gem need to be able to find a certain file in the system PATH - setting the PATH programatically doesn't work, as these programs are being called in a way that they get a fresh environment.
I tried including these .dll files as "executables" in the gemspec, but that only seems to get some symlink type files in the {ruby}/bin
folder, which causes errors because the programs in question are expecting the actual .dll.
As it is, I just have a note in the README asking people to manually copy the .dll files to a folder in the PATH, but it seems like there should be a better way to do this.
Any help would be appreciated - thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜这个dll是java类所需的本机库?
如果是这样,您可以将其放在 lib 文件夹中的某个位置,并在使用 java 类之前调用 java.lang.System.load 加载它。它不必以这种方式位于系统路径中。
I guess the dll is a native lib required by a java class?
If so, you can just put it somewhere in the lib folder and call java.lang.System.load to load it before the java class is used. It doesn't have to be in system PATH this way.