-/**
-Processes options from the given raw option map. Nonexistent options are
-ignored. If any options were changed, the mtime of the configuration is updated
-to the current time.
+void Config::select_last_profile()
+{
+ FS::Path profile_cache_fn = package.get_source()/".profile";
+ if(FS::exists(profile_cache_fn))
+ {
+ IO::BufferedFile in(profile_cache_fn.str());
+ string profile;
+ in.getline(profile);
+ set_option("profile", profile);
+ }
+
+ freeze_mtime = true;
+ package.get_builder().apply_profile_template(*this, get_option("profile").value);
+ freeze_mtime = false;
+
+ load();
+}
+
+void Config::select_profile(const string &profile)
+{
+ set_option("profile", profile);
+
+ freeze_mtime = true;
+ package.get_builder().apply_profile_template(*this, profile);
+ freeze_mtime = false;
+
+ load();
+}
+
+bool Config::update(const StringMap &opts)
+{
+ bool changed_now = false;
+ for(StringMap::const_iterator i=opts.begin(); i!=opts.end(); ++i)
+ {
+ if(set_option(i->first, i->second) && i->first!="profile")
+ changed_now = true;
+ }
+
+ if(changed_now && !freeze_mtime)
+ {
+ mtime = Time::now();
+ changed = true;
+ }