ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17182] New: - Cab task fails when a file being "cabbed" has spaces in the name.
Date Tue, 18 Feb 2003 21:15:22 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17182>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17182

Cab task fails when a file being "cabbed" has spaces in the name.

           Summary: Cab task fails when a file being "cabbed" has spaces in
                    the name.
           Product: Ant
           Version: 1.4.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jpeck@afsimage.com


If a file being put into a Cab file with Cab task has a space in the file 
name, the cab task fails.  Cabarc prints an error message:  FCFileAdd() failed 
to open file.  Workaround:  Don't put spaces in any file names.  This 
workaround is a problem becuase the OSD file in the cab often requires spaces 
in its name because its filename will be display to the user.

For my personal use, I corrected this problem by changing the method, File 
createListFile(Vector files), to put quotation marks around filenames.  The 
new method body looks like this:
{
        File listFile = fileUtils.createTempFile("ant", "", null);

        PrintWriter writer = new PrintWriter(new FileOutputStream(listFile));

        String curFilename;
        
        int filesSize = files.size();
        for (int i = 0; i < filesSize; i++) {
            curFilename = '\"' + files.elementAt(i).toString() + '\"';
            writer.println(curFilename);
        }
        writer.close();

        return listFile;
}

Note: I also corrected a performance issue cause by calling a (synchronized) 
method in a loop (Vector.size()).

Mime
View raw message