@@ -1,7 +1,7 @@
/*
/*
* The Apache Software License, Version 1.1
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
* reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
@@ -83,6 +83,7 @@ public class ExecuteOn extends ExecTask {
protected Vector filesets = new Vector();
protected Vector filesets = new Vector();
private boolean relative = false;
private boolean relative = false;
private boolean parallel = false;
private boolean parallel = false;
private boolean forwardSlash = false;
protected String type = "file";
protected String type = "file";
protected Commandline.Marker srcFilePos = null;
protected Commandline.Marker srcFilePos = null;
private boolean skipEmpty = false;
private boolean skipEmpty = false;
@@ -144,6 +145,14 @@ public class ExecuteOn extends ExecTask {
this.destDir = destDir;
this.destDir = destDir;
}
}
/**
* The source and target file names on Windows and OS/2 must use
* forward slash as file separator.
*/
public void setForwardslash(boolean forwardSlash) {
this.forwardSlash = forwardSlash;
}
/**
/**
* Marker that indicates where the name of the source file should
* Marker that indicates where the name of the source file should
* be put on the command line.
* be put on the command line.
@@ -284,6 +293,7 @@ public class ExecuteOn extends ExecTask {
* @param baseDir filenames are relative to this dir
* @param baseDir filenames are relative to this dir
*/
*/
protected String[] getCommandline(String[] srcFiles, File[] baseDirs) {
protected String[] getCommandline(String[] srcFiles, File[] baseDirs) {
final char fileSeparator = File.separatorChar;
Vector targets = new Vector();
Vector targets = new Vector();
if (targetFilePos != null) {
if (targetFilePos != null) {
Hashtable addedFiles = new Hashtable();
Hashtable addedFiles = new Hashtable();
@@ -297,6 +307,9 @@ public class ExecuteOn extends ExecTask {
} else {
} else {
name = subTargets[j];
name = subTargets[j];
}
}
if (forwardSlash && fileSeparator != '/') {
name = name.replace(fileSeparator, '/');
}
if (!addedFiles.contains(name)) {
if (!addedFiles.contains(name)) {
targets.addElement(name);
targets.addElement(name);
addedFiles.put(name, name);
addedFiles.put(name, name);
@@ -380,6 +393,10 @@ public class ExecuteOn extends ExecTask {
} else {
} else {
result[srcIndex + i] = srcFiles[i];
result[srcIndex + i] = srcFiles[i];
}
}
if (forwardSlash && fileSeparator != '/') {
result[srcIndex + i] =
result[srcIndex + i].replace(fileSeparator, '/');
}
}
}
return result;
return result;
}
}