+/* $Id$
+
+This file is part of builder
+Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
#include <fstream>
-#include <msp/error.h>
+#include <msp/core/except.h>
#include <msp/path/utils.h>
#include <msp/time/utils.h>
#include "builder.h"
#include "config.h"
-#include "package.h"
+#include "sourcepackage.h"
using namespace std;
using namespace Msp;
-Config::Config(Package &p):
+Config::Config(SourcePackage &p):
package(p),
freeze_mtime(false)
{ }
void Config::save() const
{
- Path::Path fn=package.get_source()/".options.cache";
+ Path fn=package.get_source()/".options.cache";
OptionMap::const_iterator i=options.find("profile");
if(i!=options.end())
ofstream out(fn.str().c_str());
if(!out) return;
-
+
for(i=options.begin(); i!=options.end(); ++i)
out<<"option \""<<i->second.name<<"\" \""<<i->second.value<<"\";\n";
}
void Config::load()
{
- Path::Path fn=package.get_source()/".options.cache";
+ Path fn=package.get_source()/".options.cache";
OptionMap::iterator i=options.find("profile");
if(i!=options.end())
ifstream in(fn.str().c_str());
if(!in) return;
- struct stat st;
- Path::stat(fn, st);
- mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
+ mtime=Time::TimeStamp::from_unixtime(stat(fn).st_mtime);
- Parser::Parser parser(in, fn.str());
+ DataFile::Parser parser(in, fn.str());
Loader loader(*this);
loader.load(parser);
}