-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
1 changed file
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,54 @@ | |
|
||
package cloud.piranha.uber; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* The uber version of Piranha. | ||
* The Uber version of Piranha. | ||
* | ||
* @author Manfred Riem ([email protected]) | ||
*/ | ||
public class UberPiranha { | ||
public class UberPiranha implements Runnable { | ||
|
||
/** | ||
* Stores the temporary directory. | ||
*/ | ||
private File tempDirectory = new File(".piranhaUber"); | ||
|
||
/** | ||
* Main method. | ||
* | ||
* @param arguments the command-line arguments. | ||
*/ | ||
public static void main(String[] arguments) { | ||
UberPiranha piranha = new UberPiranha(); | ||
piranha.parseArguments(arguments); | ||
piranha.run(); | ||
} | ||
|
||
/** | ||
* Parse the arguments. | ||
* | ||
* @param arguments the arguments. | ||
*/ | ||
private void parseArguments(String[] arguments) { | ||
for(int i=0; i<arguments.length; i++) { | ||
if (arguments[i].equals("--uber-temp-directory")) { | ||
tempDirectory = new File(arguments[i + 1]); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Run method. | ||
*/ | ||
@Override | ||
public void run() { | ||
if (!tempDirectory.exists()) { | ||
if (!tempDirectory.mkdirs()) { | ||
System.err.println("Unable to create temporary directory, exiting"); | ||
System.exit(1); | ||
} | ||
} | ||
} | ||
} |