]> git.tdb.fi Git - builder.git/blobdiff - source/config.cpp
Update bootstrap.sh and Readme.txt to reflect the msppath -> mspfs transition
[builder.git] / source / config.cpp
index 753a4ef65b0577dca6bf0301290898461cd188de..a83a641a5bcaa66dbfcf2eda1ee477ab13648306 100644 (file)
@@ -5,11 +5,13 @@ Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
+#include <cstdlib>
 #include <msp/core/except.h>
+#include <msp/fs/stat.h>
+#include <msp/fs/utils.h>
 #include <msp/io/except.h>
 #include <msp/io/file.h>
 #include <msp/io/print.h>
-#include <msp/path/utils.h>
 #include <msp/time/utils.h>
 #include "builder.h"
 #include "config.h"
@@ -64,7 +66,7 @@ void Config::select_last_profile()
 {
        try
        {
-               IO::File in((package.get_source()/".profile.cache").str());
+               IO::File in((package.get_source()/".profile").str());
                string profile;
                in.getline(profile);
                set_option("profile", profile);
@@ -89,7 +91,7 @@ void Config::select_profile(const string &profile)
 
        if(!package.get_builder().get_dry_run())
        {
-               IO::File out((package.get_source()/".profile.cache").str(), IO::M_WRITE);
+               IO::File out((package.get_source()/".profile").str(), IO::M_WRITE);
                IO::print(out, "%s\n", profile);
        }
 
@@ -150,7 +152,7 @@ void Config::finish()
                                }
                                else
                                {
-                                       for(end=dollar+1; (isalnum(opt.value[end]) && opt.value[end]!='_'); ++end);
+                                       for(end=dollar+1; (isalnum(opt.value[end]) && opt.value[end]!='_'); ++end) ;
                                        var=opt.value.substr(dollar+1, end-dollar-1);
                                }
 
@@ -176,7 +178,7 @@ void Config::finish()
 
 void Config::save() const
 {
-       Path fn=package.get_source()/".options.cache";
+       FS::Path fn=package.get_source()/".options.cache";
 
        OptionMap::const_iterator i=options.find("profile");
        if(i!=options.end())
@@ -205,18 +207,14 @@ bool Config::set_option(const string &opt, const string &val)
 
 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");
+       FS::Path fn=package.get_source()/(".options."+get_option("profile").value);
 
        try
        {
                IO::File inf(fn.str());
                IO::Buffered in(inf);
 
-               mtime=Time::TimeStamp::from_unixtime(stat(fn).st_mtime);
+               mtime=Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime);
 
                DataFile::Parser parser(in, fn.str());
                Loader loader(*this);