ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <>
Subject Resolving file paths with "/" instead of "\" when using DirectoryScanner
Date Sun, 29 Apr 2001 11:25:02 GMT

I'm writing an Ant task that used a nested fileset. My problem is that when
I use the following code to list the files that have been specified by the
<fileset> tags, all diretories are written using a "\" (that's normal I
guess becuase I am on a win 2000 system). However I need to pass this list
of files to a 'cvs' command, and the cvs server is on a unix system. How can
I convert the filepath to a unix style (with "/" instead of "\") ?

Here is my code :

            Enumeration e = m_Filesets.elements();
            while(e.hasMoreElements()) {
                FileSet fs = (FileSet)e.nextElement();
                DirectoryScanner ds = fs.getDirectoryScanner(project);
                String[] srcFiles = ds.getIncludedFiles();
                for (int i = 0; i < srcFiles.length; i++) {
                    toExecute.createArgument().setValue(srcFiles[i]); // I
need "/" here instead of "\" in the directory names ...

Thanks a lot

View raw message