public static String findApplicationName ( final File templateDir , final File templateFile ) { final File parentDir = templateFile . getParentFile ( ) ; final String appName ; // No intermediate directory, the template is global! if ( templateDir . equals ( parentDir ) ) appName = null ; // One intermediate directory: the template is specific to one application. // The name of the application is the name of the intermediate directory. else if ( templateDir . equals ( parentDir . getParentFile ( ) ) ) appName = parentDir . getName ( ) ; // Too many levels! else throw new IllegalArgumentException ( "Not a template file: " + templateFile ) ; return appName ; }
Finds an application name from a template file .