Code for making a directory in the user's home space
Details:
This code makes a directory in the user's homespace for writing results etc. to, and returns the path as a String.
Original author/s: ESRI
Original location/s: How to consume custom geoprocessing tools in Java applications
License: unknown
Imports and instance variables:
import java.io.File;
Code:
private String getOutputDir(){
String userDir;
if (System.getProperty("os.name").toLowerCase().indexOf("win") > - 1)
userDir = System.getenv("UserProfile");
else
userDir = System.getenv("HOME");
String outputDir = userDir + "/arcgis_sample_output"; // Although this uses a forward-slash, Java sorts it out for all OS.
System.out.println("Creating output directory - " + outputDir);
new File(outputDir).mkdir();
return outputDir;
}