/* attempts to load from a file on disk. if the file doesn't exist then * parse it for real and save it to disk. */ Util::ReferenceCount<Ast::AstParse> Parser::loadFile(const Filesystem::AbsolutePath & path){ try{ return loadCached(path); } catch (const TokenException & fail){ Global::debug(1, "mugen-parse-cache") << "Cache load warning: " << fail.getTrace() << endl; } catch (const MugenException & fail){ Global::debug(1, "mugen-parse-cache") << "Cache load warning: " << fail.getTrace() << endl; } catch (const Filesystem::Exception & fail){ Global::debug(1, "mugen-parse-cache") << "Cache load warning: " << fail.getTrace() << endl; } Global::debug(1, "mugen-parse-cache") << "Parsing " << path.path() << endl; Util::ReferenceCount<Ast::AstParse> out = doParse(path); try{ saveCached(out, path); } catch (...){ Global::debug(0) << "Failed to save cached file " << path.path() << endl; /* failed for some reason */ } return out; }
void loadModel() { loadCached(); connectMap(); mapSave(); }