有没有办法设置相对于 .project 文件的链接资源? [英] Is there a way to setup Linked Resources relative to the .project file?

查看:41
本文介绍了有没有办法设置相对于 .project 文件的链接资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 Flash Builder(基于 Eclipse)项目,它从不同的位置提取源代码,包含在项目所在的源代码管理中.根据我们的组织要求,源代码存在于不直接位于项目目录下的目录中.最初我们遇到的问题是链接资源的所有路径都是绝对路径,并且在其他具有不同路径的机器上不起作用.

We have a Flash Builder (which is based on Eclipse) project that pulls source from different locations, included in the source control in which the project is. As per our organization requirements, the source code is present in directories not directly under the project directory. Initially we had the problem that all paths to the linked resources were absolute and did not work on other machines with different paths.

现在,我们对此的解决方案是设置一个指向工作文件夹根目录的链接资源路径变量.所有其他位置都基于此,因此我们可以包含来自诸如

Right now, the solution we have for this is to set up a Linked Resource Path Variable that points to the root of the working folder. All other locations are based on that, so we can include source from folders like

${WORKING_BASE}/library1
${WORKING_BASE}/library2

这个解决方案的问题在于,每个拉动项目的人都必须在打开项目之前正确设置 WORKING_BASE 变量才能使其工作.我的问题是,有没有办法让链接资源相对于 .project 文件的位置?那将是理想的.

The problem with this solution is that everyone that pulls the project has to set the WORKING_BASE variable correctly before opening the project for it to work. My question is, is there a way to make the Linked Resources relative to the location of the .project file? That would be ideal.

推荐答案

从 Eclipse 3.6 (Helios) 起就有可能

It is possible since Eclipse 3.6 (Helios)

打开项目属性并转到资源 > 链接资源 > 路径变量.

Open the project properties and goto Resources > Linked Resources > Path Variables.

在那里您可以创建一个相对于现有变量的新变量.例如:
名称:MY_SOURCE_FOLDER
位置:${PROJECT_LOC}..src

There you can create a new variable relative to an existing one. For instance:
Name: MY_SOURCE_FOLDER
Location: ${PROJECT_LOC}..src

这将向您的 .project 文件添加一个新的 Path 变量,其值类似于:

This will add a new Path variable to your .project file with a value like:

$%7BPARENT-1-PROJECT_LOC%7D/src

表示${PARENT-1-PROJECT_LOC}/src,其中1表示PROJECT_LOC以上1倍的父目录.

meaning ${PARENT-1-PROJECT_LOC}/src, where the 1 means the parent directory 1 times above PROJECT_LOC.

这篇关于有没有办法设置相对于 .project 文件的链接资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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