如何在 Ant concat 中保留文件顺序? [英] How to preserve file order in Ant concat?
问题描述
如何在 Ant concat 中保留文件顺序?
How to preserve file order in Ant concat?
使用文件集进行简单连接 &includefile 产生相当随机"的顺序,因为顺序不能保证:
Simple concat with fileset & includesfile produces rather "random" order, as order is not guaranteed:
<concat destfile="C:/targetdir/concatenated.file">
<fileset dir="C:/sourcedir/">
<includesfile name="C:/targetdir/includes.file" />
</fileset>
</concat>
我需要的是按特定顺序连接文件在包含文件中列出.
What I need is concatenation in specific order that the files are listed in the includes file.
到目前为止,我找到了 resourcelist,它应该保留顺序,但我似乎无法用它生成任何连接文件.:/
So far I've found resourcelist, which should preserve order, but I can't seem to be able to produce any concatenated file with it. :/
<concat destfile="C:/targetdir/concatenated.file">
<resourcelist>
<file file="C:/targetdir/includes.file"/>
<filterchain>
<striplinecomments>
<comment value="#"/>
</striplinecomments>
<prefixlines prefix="C:/sourcedir/"/>
</filterchain>
</resourcelist>
</concat>
另外,资源列表似乎无法处理像
Plus, the resourcelist can't seem to handle rows like
LibraryX/A/Stuff/Morestuff/*
相反,该行仅产生.../Morestuff/* 不存在".-错误
Instead the row just produces a ".../Morestuff/* does not exist." -error
包含文件的相对路径列表:
Includes file has list of relative paths:
LibraryX/A/Stuff/FileA.txt
LibraryX/A/Stuff/FileB.txt
LibraryX/A/Stuff/FileC.txt
LibraryX/A/Stuff/FileY.txt
推荐答案
我能够很容易地使文件列表工作:
I was able to get a filelist working pretty easily:
<concat destfile="C:/targetdir/concatenated.file">
<filelist dir="C:/sourcedir/">
<file name="i.txt" />
<file name="n.txt" />
<file name="o.txt" />
<file name="r.txt" />
<file name="d.txt" />
<file name="e.txt" />
<file name="r.txt" />
</filelist>
</concat>
希望有帮助!
这篇关于如何在 Ant concat 中保留文件顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!