应该“库路径”指向包的源文件? [英] Should "Library path" point to the source files of packages?

查看:156
本文介绍了应该“库路径”指向包的源文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

库路径是否指向包的源文件?
Delphi 7文档说是的。但是其他人说:库路径应该导致编译文件(.dcp,.dcu)和(如果需要的话)资源文件(.res,.dfm)。



更新:

事情是,如果您不要在库路径中添加包的路径,那么每次创建新的DPR项目时,都必须手动收集您的软件包的路径(许多),并将其输入到项目的选项浏览框中,否则您将获得找不到文件xxx.dcu。这听起来不太好多年来,我曾经在Library中添加所有的路径,每次创建一个新项目时,都不需要手动添加路径。




  • 我的软件包是通用的/全局的(不是单个项目的特定项目,而是许多项目)。

  • 我使用一台计算机编程,所以我不在乎分享代码。

  • 我将PAS和DCU文件放在同一个文件夹中。

  • 我不介意经常重新编译PAS文件。编译需要1-2秒,构建需要3-4秒。

  • 相对路径是出于问题,因为Delphi(所有版本)似乎有时在打开文件时更改工作目录,反过来,混淆相对路径(它们相对于工作目录,而不是.dpr(oj))。如果我注意到,我在工作目录中打开一个文件(使用file-> Open),一切都很好再次。

  • 我用来在一天内大量修改大部分的包。



< hr>

Delphi 7在设置路径和官方文档是0时是如此的混乱:(



更新: br>
我已经做了改变,它的作品,但它甚至不是完美的(或至少是优雅的):如何在使用Delphi与非特定库路径时删除重复资源(RES,DFM)?

解方案

OP在评论中说:


事情是,如果你不添加路径您的软件包在库路径中,然后每一次创建一个新的DPR项目,您必须手动收集您的软件包的路径(许多),并将其输入到项目的选项浏览框中,否则您将获得文件xxx .dcu未找到


不是真的。您需要创建一个默认项目选项。为了做到这一点,加载Delphi(我在说这里的D2010,但至少在D7中提供了相同的功能),并确保IDE中没有加载项目。



之后,打开一个文件(任何文件)并转到Project / Default Options / Delphi(或者C ++ Builder,你可以选择个性)。这将打开一个基本的项目选项屏幕。配置它,直到你快乐,然后按OK。



使用文件/新建/ VCL表单应用程序创建一个新项目,并查看您应用的默认设置。



编辑:由于XE2,默认项目被替换为选项集



帮助链接:
请参阅 http://docwiki.embarcadero.com/RADStudio/en/IDE_Changes_for_XE2#Default_Checkbox_Removed_from_Project_Options_Pages http://docwiki.embarcadero.com/RADStudio/en/Option_Sets_-



_Creating,_Applying,_Editing,_and_Deleting - 查看更多信息: http://codeverge.com/ embarcadero.delphi.ide / project-options-default-xe2 / 1058015#sthash.oovBcggS.dpuf


Should "Library path" point to the source files of packages? Delphi 7 documentation says yes. But other people say no: "The "Library" path should lead to compiled files (.dcp, .dcu) and (if needed) resource files (.res, .dfm) only".

Update:
The thing is that if you DON'T add the path to your packages in the "Library path" then every single time you create a new DPR project you have to manually collect the path to your packages (many) and enter them into the Project's Option "Browse" box, else you will get "file xxx.dcu not found". This doesn't sound that nice. For years I used to add all my paths in Library and never had to manually add the paths every time I created a new project.

  • My packages are universal/global (not specific to a single project but to many projects).
  • I use one single computer for programming so I don't care about sharing the code.
  • I have the PAS and DCU files in the same folder.
  • I don't mind recompiling the PAS files often. Compile takes 1-2 seconds, build takes 3-4 seconds.
  • Relative paths ARE OUT OF QUESTION because "Delphi (all versions) seems to change the working directory sometimes on opening files, which in turn messes up relative paths (they are relative to the working dir, not the .dpr(oj) apparently). If I notice this, I open a file (using file->Open) in the working dir, and all is fine again."
  • I use to edit most of the packages a lot in a single day.

Delphi 7 is such a mess when about setting the paths and official documentation is 0. :(

UPDATE:
I have done the change. It works, but it not even by far perfect (or at least elegant): How to remove duplicate resources (RES, DFM) while using Delphi with non specific Library paths?

解决方案

The OP said in a comment:

The thing is that if you DON'T add the path to your packages in the "Library path" then every single time you create a new DPR project you have to manually collect the path to your packages (many) and enter them into the Project's Option "Browse" box, else you will get "file xxx.dcu not found"

Not really. You need to create a Default Project Option. To make that, load Delphi (I'm talking of D2010 here, but same feature is available in, at least, D7) and make sure there is no loaded project in IDE.

After that, open a file (any file) and go to Project/Default Options/Delphi (or C++ Builder, you'll have the choice of personality). That will open a base Project Options screen. Configure it until you're happy and press OK.

Make a new project with File/New/VCL Forms Application and see your default settings applied.

EDIT: Since XE2, the Default Project was substituted by the Option Sets.

Help links: See http://docwiki.embarcadero.com/RADStudio/en/IDE_Changes_for_XE2#Default_Checkbox_Removed_from_Project_Options_Pages http://docwiki.embarcadero.com/RADStudio/en/Option_Sets_-

_Creating,_Applying,_Editing,_and_Deleting - See more at: http://codeverge.com/embarcadero.delphi.ide/project-options-default-xe2/1058015#sthash.oovBcggS.dpuf

这篇关于应该“库路径”指向包的源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆