private File getWarDirectory ( TreeLogger logger ) throws UnableToCompleteException { File currentDirectory = new File ( "." ) ; try { String canonicalPath = currentDirectory . getCanonicalPath ( ) ; logger . log ( TreeLogger . INFO , "Current directory in which this generator is executing: " + canonicalPath ) ; if ( canonicalPath . endsWith ( "war" ) ) { return currentDirectory ; } else { return new File ( "war" ) ; } } catch ( IOException e ) { logger . log ( TreeLogger . ERROR , "Failed to get canonical path" , e ) ; throw new UnableToCompleteException ( ) ; } }
When invoking the GWT compiler from GPE the working directory is the Eclipse project directory . However when launching a GPE project the working directory is the project war directory . This methods returns the war directory in either case in a fairly naive and non - robust manner .