Skip to content

Commit

Permalink
if programFile is specificied, only make that executable
Browse files Browse the repository at this point in the history
  • Loading branch information
brianm committed Mar 7, 2013
1 parent 001451a commit fd6df1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/skife/waffles/MyMojo.java
Expand Up @@ -62,7 +62,6 @@ public void execute() throws MojoExecutionException

for (Object item : project.getAttachedArtifacts()) {
AttachedArtifact artifact = (AttachedArtifact) item;

if (shouldProcess(artifact)) {
files.add(artifact.getFile());
}
Expand All @@ -72,17 +71,18 @@ public void execute() throws MojoExecutionException
throw new MojoExecutionException("Could not find any jars to make executable");
}

for (File file : files) {
makeExecutable(file);
}

if (programFile != null && !programFile.matches("\\s+")) {
for (File file : files) {
File dir = file.getParentFile();
File exec = new File(dir, programFile);
FileUtils.copyFile(file, exec);
makeExecutable(exec);
Runtime.getRuntime().exec("chmod +x " + exec.getAbsolutePath());
}
} else {
for (File file : files) {
makeExecutable(file);
}
}

}
Expand Down

0 comments on commit fd6df1e

Please sign in to comment.