/** * Return the ConfiguratorConfigFile which is determined by the parameters set in Manipulator. * * @param manipulator * @return File */ private static File getConfigFile(Manipulator manipulator) throws IllegalStateException { File fwConfigLoc = manipulator.getLauncherData().getFwConfigLocation(); File baseDir = null; if (fwConfigLoc == null) { baseDir = manipulator.getLauncherData().getHome(); if (baseDir == null) { if (manipulator.getLauncherData().getLauncher() != null) { baseDir = manipulator.getLauncherData().getLauncher().getParentFile(); } else { throw new IllegalStateException( "All of fwConfigFile, home, launcher are not set."); //$NON-NLS-1$ } } } else { if (fwConfigLoc.exists()) if (fwConfigLoc.isDirectory()) baseDir = fwConfigLoc; else baseDir = fwConfigLoc.getParentFile(); else { // TODO We need to decide whether launcher data configLocation is the location of a file or // a directory if (fwConfigLoc.getName().endsWith(".ini")) // $NON-NLS-1$ baseDir = fwConfigLoc.getParentFile(); else baseDir = fwConfigLoc; } } File configuratorFolder = new File(baseDir, SimpleConfiguratorManipulatorImpl.CONFIGURATOR_FOLDER); File targetFile = new File(configuratorFolder, SimpleConfiguratorManipulatorImpl.CONFIG_LIST); if (!Utils.createParentDir(targetFile)) return null; return targetFile; }