Methods Summary |
---|
public static java.io.File | createTempDir()
startup();
for (int i=0;i<16;i++){
File f = File.createTempFile( PREFIX, SUFFIX, tmp_dir );
f.delete();
if ( f.mkdirs()){
return( f );
}
}
throw( new IOException( "Failed to create temporary directory in " + tmp_dir ));
|
public static java.io.File | createTempFile()
startup();
return( File.createTempFile( PREFIX, SUFFIX, tmp_dir ));
|
public static synchronized void | startup()
if ( started_up ){
return;
}
started_up = true;
try{
tmp_dir = FileUtil.getUserFile( "tmp" );
if ( tmp_dir.exists()){
File[] files = tmp_dir.listFiles();
if ( files != null ){
for (int i=0;i<files.length;i++){
File file = files[i];
if ( file.getName().startsWith(PREFIX) && file.getName().endsWith(SUFFIX)){
if ( file.isDirectory()){
FileUtil.recursiveDelete( file );
}else{
file.delete();
}
}
}
}
}else{
tmp_dir.mkdir();
}
}catch( Throwable e ){
try{
tmp_dir = File.createTempFile(PREFIX,SUFFIX).getParentFile();
}catch( Throwable f ){
tmp_dir = new File("");
}
// with webui we don't have the file stuff so this fails with class not found
if ( !(e instanceof NoClassDefFoundError )){
Debug.printStackTrace( e );
}
}
|