在蚂蚁,我怎么用逗号分隔的文件名的文件中指定? [英] In Ant, how do I specify files with comma in filename?

查看:298
本文介绍了在蚂蚁,我怎么用逗号分隔的文件名的文件中指定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是一个例子目标,我试图。事实证明,它要删除一切,因为逗号中隔离的 * 的* / *和覆盖 - 理解

Here is an example-target that I tried. Turns out, it wants to delete everything because the comma separates "**/*" and "cover" -- understandable.

<target name="clean">
    <delete
        verbose="true">
        <fileset dir="." includes="**/*.pyo"></fileset>
        <fileset dir="." includes="**/*,cover"></fileset>
    </delete>
</target>

我如何指定嵌入式逗号?

How do I specify an embedded comma?

我想学习蚂蚁,所以我不会要保持不同的构建系统针对不同的操作系统系统。在这种情况下,它是在一个Python环境,其中*,盖文件由code-覆盖检查工具叫做的覆盖

I'm trying to learn Ant so I won't have to maintain different build-systems for different operating-systems. In this case, it's in a Python environment, where *,cover files are created by a code-coverage checking tool called Coverage.

推荐答案

您不需要离开这个。只需使用&LT;包括/&GT; 而不是包括 ARG。试试这个:

You don't need to escape this. Just use <include/> instead of includes arg. Try this:

<project name="test" default="clean">

    <dirname property="build.dir" file="${ant.file.test}" />

    <target name="clean">
        <delete>
            <fileset dir="${build.dir}/test">
                <include name="**/*,*.xml" />
            </fileset>
        </delete>
    </target>

</project>

顺便说一句。你不应该使用(点)你 DIR 参数。如果你想删除目录下的文件,你已经得到的build.xml 文件,你应该通过绝对路径(要做到这一点,你可以使用&LT;目录名/&GT; 就像在我的例子)。如果您将使用,那么你将有嵌套的构建问题。让你已经有两个imageine建立其删除文件,但第一次构建也呼吁第二次构建:

By the way. You shouldn't use . (dot) in you dir argument. If you want to delete files in directory where you have got build.xml file you should pass absolute path (to do this you can use <dirname/> like in my example). If you will use . then you will have problems with nested build. Let's imageine that you have got two builds which delete files but first build also call second build:

MAINDIR / build1.xml

maindir/build1.xml

<delete dir="." includes="**/*.txt" />
<!-- call clean target from build2.xml -->
<ant file="./subdir/build2.xml" target="clean"/>

MAINDIR /子目录/ build2.xml

maindir/subdir/build2.xml

<delete dir="." includes="**/*.txt" />

在这种情况下,build2.xml不会删除MAINDIR子目录中的* .txt文件,但* .txt文件,因为蚂蚁的属性将被传递给build2.xml。当然你也可以使用 inheritAll =FALSE忽略这一点,但根据我的经验,我知道,使用的路径会为你带来很多问题。

In this case build2.xml won't delete *.txt files in subdir but *.txt files in maindir because ant properties will be passed to build2.xml. Of course you can use inheritAll="false" to omit this but from my experience I know that using . in paths will bring you a lot of problems.

这篇关于在蚂蚁,我怎么用逗号分隔的文件名的文件中指定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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