Skip to content

Commit

Permalink
Issue #213: cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Willem Janssen committed Sep 16, 2014
1 parent b8511b9 commit a5cd73c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions runner/src/main/java/nl/lxtreme/ols/runner/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,27 @@ else if ( cmdLineArg.startsWith( "-cacheDir=" ) )
{
throw new IllegalArgumentException( "Invalid log level, should be between 0 and 6!" );
}
if ( "".equals( _pluginDir ) || !new File( _pluginDir ).exists() )

this.pluginDir = new File( _pluginDir ).getCanonicalFile();
if ( "".equals( _pluginDir ) || !this.pluginDir.exists() )
{
throw new IllegalArgumentException( "Invalid plugin directory: no such directory (" + _pluginDir + ")!" );
throw new IllegalArgumentException( String.format( "Invalid plugin directory (%s)!", this.pluginDir ) );
}

if ( _cacheDir == null )
{
_cacheDir = new File( _pluginDir.concat( "/../.fwcache" ) ).getAbsolutePath();
_cacheDir = new File( _pluginDir, "/../.fwcache" ).getAbsolutePath();
}

this.pluginDir = new File( _pluginDir ).getCanonicalFile();
this.cacheDir = new File( _cacheDir ).getCanonicalFile();
this.cleanCache = _cleanCache;
this.logLevel = _logLevel;

// One final test: make sure we can create our cache folder...
if ( !this.cacheDir.exists() && !this.cacheDir.mkdirs() )
{
throw new IllegalArgumentException( "Invalid cache directory: unable to create directory (" + _cacheDir + ")!" );
throw new IllegalArgumentException( String.format( "Invalid cache directory (%s): cannot create directory!",
this.cacheDir ) );
}

this.cleanCache = _cleanCache;
this.logLevel = _logLevel;
}

// METHODS
Expand Down

0 comments on commit a5cd73c

Please sign in to comment.