diff --git a/tools/cooja/java/se/sics/cooja/ProjectConfig.java b/tools/cooja/java/se/sics/cooja/ProjectConfig.java index cd7834838..e60f488f9 100644 --- a/tools/cooja/java/se/sics/cooja/ProjectConfig.java +++ b/tools/cooja/java/se/sics/cooja/ProjectConfig.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ProjectConfig.java,v 1.3 2008/10/03 10:23:33 fros4943 Exp $ + * $Id: ProjectConfig.java,v 1.4 2009/10/28 12:05:43 fros4943 Exp $ */ package se.sics.cooja; @@ -135,15 +135,19 @@ public class ProjectConfig { */ public boolean appendProjectDir(File projectDir) throws FileNotFoundException, IOException { - myProjectDirHistory.add(projectDir); - - File projectConfig = new File(projectDir.getPath(), - GUI.PROJECT_CONFIG_FILENAME); - if (projectConfig.exists()) { - return appendConfigFile(projectConfig); + if (projectDir == null) { + throw new FileNotFoundException("No project directory specified"); } - - return true; + if (!projectDir.exists()) { + throw new FileNotFoundException("Project directory does not exist: " + projectDir.getAbsolutePath()); + } + + File projectConfig = new File(projectDir.getPath(), GUI.PROJECT_CONFIG_FILENAME); + if (!projectConfig.exists()) { + throw new FileNotFoundException("Project config does not exist: " + projectConfig.getAbsolutePath()); + } + myProjectDirHistory.add(projectDir); + return appendConfigFile(projectConfig); }