简体   繁体   English

如何更改依赖项的文件扩展名

[英]How do I change the file extension for dependencies

I'm building a program that uses Delphi Packages (BPLs) as plugins, but I'd like to use a custom extension to show that the files have a specific purpose instead of just being BPLs. 我正在构建一个使用Delphi包(BPL)作为插件的程序,但我想使用自定义扩展来显示文件具有特定目的而不仅仅是BPL。 That works well enough until I end up with one package having a dependency on another. 这很有效,直到我最终得到一个依赖于另一个的包。 Then the compiler automatically creates the binary with the extension BPL built in. 然后编译器自动创建内置扩展名为BPL的二进制文件。

This wouldn't be too hard to fix with a hex editor, but that's sort of an extreme solution. 使用十六进制编辑器修复这个问题并不难,但这是一种极端的解决方案。 Is there any way I could make the compiler generate the packages with the right dependency names in the first place? 有没有什么办法可以让编译器首先生成具有正确依赖项名称的包?

EDIT: The answers so far seem to have not understood the question. 编辑:到目前为止答案似乎还没有理解这个问题。

I know exactly how to create the packages with my custom TEP extension instead of a BPL extension. 我确切知道如何使用我的自定义TEP扩展而不是BPL扩展来创建包。 But if I have package1.TEP and package2.TEP, and package2 depends on package1, and then I try to load package2, it gives an error because it can't find "package1.BPL". 但是,如果我有package1.TEP和package2.TEP,并且package2依赖于package1,然后我尝试加载package2,它会出错,因为它找不到“package1.BPL”。 What I want is to find some simpler way to make package2 look for the correct filename, "package1.TEP," that doesn't involve editing the binary after it's been created. 我想要的是找到一些更简单的方法来使package2查找正确的文件名“package1.TEP”,它不涉及在创建后编辑二进制文件。 Is there any way to do that? 有没有办法做到这一点?

The simplest solution would be to use a post build event to rename your destination file from *.BPL to whatever specific extension you are requiring. 最简单的解决方案是使用post build事件将目标文件从* .BPL重命名为您需要的任何特定扩展名。

EDIT: You could write a separate patch program to search for and patch the offending binaries and run it as part of the post build process. 编辑:您可以编写一个单独的补丁程序来搜索和修补有问题的二进制文件,并将其作为后期构建过程的一部分运行。 If a patch is made to the compiler, then you can remove your step easily. 如果对编译器进行了修补,则可以轻松删除步骤。

使用{$E}指令。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过打开具有自定义文件扩展名的文件来查找触发的文件路径? - How do I find out the path of the file triggered by opening a file with a custom file extension? 如何在 WM_DROPFILES 期间根据文件扩展名更改 cursor - How can I change the cursor depending on the file extension during WM_DROPFILES 如何在 Delphi 中获得给定 MIME 类型的标准文件扩展名? - How do I get the standard file extension given a MIME type in Delphi? 如何发现我的服务的依赖项是什么? - How do I discover what my service's dependencies are? (保存对话框)如何在Vista / Win7中更改文件过滤器时自动更改文件扩展名? - (Save Dialog) How to change file extension automatically on file filter change in Vista/Win7? 如何删除文件? - How do I delete a file? 如何在Delphi中更改滚动条的颜色? - How do I change the color of a scrollbar in Delphi? 如何更改 ScrollBar 的宽度? - How do I change the width of a ScrollBar? 程序的后续运行如何使用先前运行的信息,以及如何更改文本文件的一行? - How can a later run of my program use information from a previous run, and how do I change a line of a text file? 如何更改我在 Delphi 文件中输入的线条的颜色,所以当我稍后将其可视化时,不同类型的线条具有不同的颜色 - How do I change the color of the line I enter in a Delphi file, so when I visualize it later different type of lines have different color
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM