通用程序参数/环境 GUI 启动器

发布于 2024-12-14 19:43:59 字数 1011 浏览 1 评论 0 原文

我开发的软件需要访问 DLL,通常需要以某种方式设置环境变量,并且可以采用命令行参数。我通常反对为了启动这些应用程序而设置/修改系统范围的环境变量,因为我可能想使用不同的依赖项(不同的 dll)等,并且我不想意外加载错误的 DLL 。

到目前为止,我一直在生成 Visual Studio .vcproj.user 文件并从 cmake 匹配批处理文件( 请参阅此处的脚本 )扩展路径以包含我的 dll 的路径,根据需要设置任何其他环境变量,然后启动应用程序,转发所有命令行参数。 (我在 Linux 上做了同样的事情,但由于 RPATH 的原因,它更简单)。当我们想要使用命令行参数启动时,该参数不仅仅是我们可以放入批处理文件中的文件,我们所做的就是复制批处理文件并编辑命令以添加我们的参数。 (都是GUI应用程序,但配置文件/标志可以在命令行上传递)

这对我和我的同事来说已经变得相当麻烦,我们最终得到了大量的批处理文件,名称相似且难以维护。这并不是一个很好的入门界面,但我们使用或开发的很多应用程序都是这样的,所以这是一项常见的任务。

我的问题是这样的:我想要一种更好的方法来配置动态库搜索路径、进程本地环境变量、工作目录、可执行文件和启动程序的参数,而不是每次手动编辑批处理文件。我做了一些挖掘尝试找到一个,但没有成功 - “启动器”倾向于将我带到常用应用程序的“键入时搜索”工具,而“命令行参数”倾向于查找使用批处理文件的建议。 (这也不是特定于Windows的问题,但是动态库路径的东西在代码/编译/运行周期中问题较少)

我已经对我的设想做了一个快速的模型:它看起来像是这样的事情它必须存在于某个地方。你知道有类似的工具吗(最好是跨平台的,开源的更好)?它不需要我在模型中放入的所有花哨的东西,但这就是如果我有时间自己构建它的话我会构建的。谢谢!

我理想工具的快速模型

I work on software that requires access to DLLs, usually wants environment variables set a certain way, and can take command line parameters. I'm generally opposed to setting/modifying system-wide environment variables for the purpose of launching these apps, since I might want to use different dependencies (different dlls), etc. and I don't want to accidentally get the wrong DLL loaded.

Up until now, I've been generating the visual studio .vcproj.user files and matching batch files from cmake ( see here for my script ) that extends the path to include the path to my dlls, sets any other environment variables as needed, and launches the application, forwarding all the command line arguments. (I do the same on Linux, but it's simpler because of RPATH). When we want to launch with a command line argument that wasn't just a file we could drop on the batch file, what we did is copy the batch file and edit the command to add our argument. (It's all GUI applications, but config files/flags can be passed on the command line)

This has become quite a hassle for me and my colleagues, and we end up with a ton of batch files, named similarly and difficult to maintain. It's not really a great interface for starting but there's a lot of apps we either use or develop that are like this, so it's a common task.

My question is this: I'd like a nicer way to configure dynamic library search paths, process-local environment variables, working directory, executable, and arguments for starting a program than hand-editing a batch file every time. I've done some digging to try to find one, but haven't been successful - "launcher" tends to bring me to "search-as-you-type" tools for frequently-used apps, and "command line argument" tends to find recommendations to use batch files. (It's not a windows-specific issue, either, but the dynamic library path stuff is less problematic during the code/compile/run cycle)

I've made a quick mockup of what I'm envisioning: it seems like the kind of thing that has to exist somewhere. Do you know of a tool similar to this (preferably cross-platform, and open source is even better)? It doesn't need all bells and whistles I put in the mockup, but that's what I'd build if I had time to build it myself. Thanks!

Quick mockup of my ideal tool

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文