]> git.tdb.fi Git - builder.git/blobdiff - source/config.cpp
Fix include and library search order
[builder.git] / source / config.cpp
index afa60e87e45f10fe3a0e0c9780e2c52c9a607741..2e3741e2a2a5120ab1d8e3bddfe573e2fc3ce21a 100644 (file)
@@ -1,15 +1,22 @@
+/* $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)
 { }
@@ -164,7 +171,7 @@ void Config::finish()
 
 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())
@@ -172,7 +179,7 @@ void Config::save() const
 
        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";
 }
@@ -194,7 +201,7 @@ bool Config::set_option(const string &opt, const string &val)
 
 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())
@@ -203,11 +210,9 @@ void Config::load()
        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);
 }