Standard prototypes are now correctly constructed even if

the directories don't exist.
This commit is contained in:
hns 2001-10-02 20:46:00 +00:00
parent 6c883367e7
commit 17b82f0d43

View file

@ -129,6 +129,7 @@ public class TypeManager {
String pname = (String) it.next(); String pname = (String) it.next();
if (prototypes.get (pname) == null) { if (prototypes.get (pname) == null) {
Prototype proto = new Prototype (pname, app); Prototype proto = new Prototype (pname, app);
registerPrototype (pname, new File (appDir, pname), proto, false);
prototypes.put (pname, proto); prototypes.put (pname, proto);
} }
} }
@ -221,60 +222,60 @@ public class TypeManager {
// show the type checker thread that there has been type activity // show the type checker thread that there has been type activity
idleSeconds = 0; idleSeconds = 0;
String list[] = dir.list();
HashMap ntemp = new HashMap (); HashMap ntemp = new HashMap ();
HashMap nfunc = new HashMap (); HashMap nfunc = new HashMap ();
HashMap nact = new HashMap (); HashMap nact = new HashMap ();
HashMap nskins = new HashMap (); HashMap nskins = new HashMap ();
HashMap updatables = new HashMap (list.length); HashMap updatables = new HashMap ();
if (update) { if (update) {
for (int i=0; i<list.length; i++) { String list[] = dir.list();
File tmpfile = new File (dir, list[i]); for (int i=0; i<list.length; i++) {
int dot = list[i].indexOf ("."); File tmpfile = new File (dir, list[i]);
int dot = list[i].indexOf (".");
if (dot < 0) if (dot < 0)
continue; continue;
String tmpname = list[i].substring(0, dot); String tmpname = list[i].substring(0, dot);
if (list[i].endsWith (app.templateExtension)) { if (list[i].endsWith (app.templateExtension)) {
try { try {
Template t = new Template (tmpfile, tmpname, proto); Template t = new Template (tmpfile, tmpname, proto);
updatables.put (list[i], t); updatables.put (list[i], t);
ntemp.put (tmpname, t); ntemp.put (tmpname, t);
} catch (Throwable x) { } catch (Throwable x) {
app.logEvent ("Error creating prototype: "+x); app.logEvent ("Error creating prototype: "+x);
} }
} else if (list[i].endsWith (app.scriptExtension) && tmpfile.length () > 0) { } else if (list[i].endsWith (app.scriptExtension) && tmpfile.length () > 0) {
try { try {
FunctionFile ff = new FunctionFile (tmpfile, tmpname, proto); FunctionFile ff = new FunctionFile (tmpfile, tmpname, proto);
updatables.put (list[i], ff); updatables.put (list[i], ff);
nfunc.put (tmpname, ff); nfunc.put (tmpname, ff);
} catch (Throwable x) { } catch (Throwable x) {
app.logEvent ("Error creating prototype: "+x); app.logEvent ("Error creating prototype: "+x);
} }
} else if (list[i].endsWith (app.actionExtension) && tmpfile.length () > 0) { } else if (list[i].endsWith (app.actionExtension) && tmpfile.length () > 0) {
try { try {
Action af = new Action (tmpfile, tmpname, proto); Action af = new Action (tmpfile, tmpname, proto);
updatables.put (list[i], af); updatables.put (list[i], af);
nact.put (tmpname, af); nact.put (tmpname, af);
} catch (Throwable x) { } catch (Throwable x) {
app.logEvent ("Error creating prototype: "+x); app.logEvent ("Error creating prototype: "+x);
} }
} else if (list[i].endsWith (app.skinExtension)) { } else if (list[i].endsWith (app.skinExtension)) {
try { try {
SkinFile sf = new SkinFile (tmpfile, tmpname, proto); SkinFile sf = new SkinFile (tmpfile, tmpname, proto);
updatables.put (list[i], sf); updatables.put (list[i], sf);
nskins.put (tmpname, sf); nskins.put (tmpname, sf);
} catch (Throwable x) { } catch (Throwable x) {
app.logEvent ("Error creating prototype: "+x); app.logEvent ("Error creating prototype: "+x);
}
} }
} }
} }
}
// Create and register type properties file // Create and register type properties file
File propfile = new File (dir, "type.properties"); File propfile = new File (dir, "type.properties");