From 0eaf74102b6c11ae209d89ff47e11705dfe00078 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 19 Apr 2001 13:14:38 +0000 Subject: [PATCH] Cleaned up code for generating standard prototype directories, and issue a warning if one could not be created or is something else than a directory. --- src/helma/framework/core/TypeManager.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/helma/framework/core/TypeManager.java b/src/helma/framework/core/TypeManager.java index 40cda5c1..39f9bfdb 100644 --- a/src/helma/framework/core/TypeManager.java +++ b/src/helma/framework/core/TypeManager.java @@ -49,18 +49,14 @@ public class TypeManager implements Runnable { public TypeManager (Application app) { this.app = app; appDir = app.appDir; - File f = new File (appDir, "user"); - if (!f.exists()) - f.mkdir (); - f = new File (appDir, "root"); - if (!f.exists()) - f.mkdir (); - f = new File (appDir, "global"); - if (!f.exists()) - f.mkdir (); - f = new File (appDir, "hopobject"); - if (!f.exists()) - f.mkdir (); + // make sure the directories for the standard prototypes exist, and lament otherwise + for (Iterator it=standardTypes.iterator (); it.hasNext (); ) { + File f = new File (appDir, (String) it.next ()); + if (!f.exists() && !f.mkdir ()) + app.logEvent ("Warning: directory "+f.getAbsolutePath ()+" could not be created."); + else if (!f.isDirectory ()) + app.logEvent ("Warning: "+f.getAbsolutePath ()+" is not a directory."); + } prototypes = new HashMap (); zipfiles = new HashMap (); registeredEvaluators = Collections.synchronizedList (new ArrayList (30));