*/
#include <msp/core/except.h>
+#include <msp/io/except.h>
#include <msp/io/file.h>
#include <msp/io/print.h>
#include <msp/path/utils.h>
in.getline(profile);
set_option("profile", profile);
}
- catch(const SystemError &)
+ catch(const IO::FileNotFound &)
{ }
freeze_mtime=true;
if(!package.get_builder().get_dry_run())
{
- try
- {
- IO::File out((package.get_source()/".profile.cache").str().c_str());
- IO::print(out, "%s\n", profile);
- }
- catch(const SystemError &)
- { }
+ IO::File out((package.get_source()/".profile.cache").str(), IO::M_WRITE);
+ IO::print(out, "%s\n", profile);
}
freeze_mtime=true;
string value;
if(is_option(var))
value=get_option(var).value;
- else
- value=getenv(var.c_str());
+ else if(var=="arch")
+ value=package.get_builder().get_current_arch().get_name();
+ else if(const char *ptr=getenv(var.c_str()))
+ value=ptr;
opt.value.replace(dollar, end-dollar, value);
if(i!=options.end())
fn=package.get_source()/(".options."+i->second.value+".cache");
- try
- {
- IO::File out(fn.str());
+ IO::File out(fn.str(), IO::M_WRITE);
- for(i=options.begin(); i!=options.end(); ++i)
- IO::print(out, "option \"%s\" \"%s\";\n", i->second.name, i->second.value);
- }
- catch(const SystemError &)
- { }
+ for(i=options.begin(); i!=options.end(); ++i)
+ IO::print(out, "option \"%s\" \"%s\";\n", i->second.name, i->second.value);
}
bool Config::set_option(const string &opt, const string &val)
try
{
- IO::File in(fn.str());
+ IO::File inf(fn.str());
+ IO::Buffered in(inf);
mtime=Time::TimeStamp::from_unixtime(stat(fn).st_mtime);
Loader loader(*this);
loader.load(parser);
}
- catch(const SystemError &)
+ catch(const IO::FileNotFound &)
{ }
}