+void Config::save() const
+{
+ Path fn=package.get_source()/".options.cache";
+
+ OptionMap::const_iterator i=options.find("profile");
+ if(i!=options.end())
+ fn=package.get_source()/(".options."+i->second.value+".cache");
+
+ try
+ {
+ IO::File out(fn.str());
+
+ for(i=options.begin(); i!=options.end(); ++i)
+ IO::print(out, "option \"%s\" \"%s\";\n", i->second.name, i->second.value);
+ }
+ catch(const SystemError &)
+ { }
+}
+
+bool Config::set_option(const string &opt, const string &val)
+{
+ bool result=false;
+
+ OptionMap::iterator i=options.find(opt);
+ if(i!=options.end())
+ {
+ if(i->second.value!=val)
+ result=true;
+ i->second.value=val;
+ }
+
+ return result;
+}
+
+void Config::load()
+{
+ Path fn=package.get_source()/".options.cache";
+
+ OptionMap::iterator i=options.find("profile");
+ if(i!=options.end())
+ fn=package.get_source()/(".options."+i->second.value+".cache");
+
+ try
+ {
+ IO::File in(fn.str());
+
+ mtime=Time::TimeStamp::from_unixtime(stat(fn).st_mtime);
+
+ DataFile::Parser parser(in, fn.str());
+ Loader loader(*this);
+ loader.load(parser);
+ }
+ catch(const SystemError &)
+ { }
+}
+
+