else
current_arch = new Architecture(*this, arch);
- load_build_file((FS::get_sys_data_dir(argv[0], "builder")/"builderrc").str());
- load_build_file((FS::get_user_data_dir("builder")/"rc").str());
+ list<FS::Path> start_files;
+ start_files.push_back(FS::get_sys_data_dir(argv[0], "builder")/"builderrc");
+ start_files.push_back(FS::get_user_data_dir("builder")/"rc");
+ for(list<FS::Path>::const_iterator i=start_files.begin(); i!=start_files.end(); ++i)
+ if(FS::exists(*i))
+ load_build_file(*i);
if(prfx.empty())
{
int Builder::main()
{
- if(load_build_file(cwd/build_file))
+ FS::Path main_file = cwd/build_file;
+ if(!FS::exists(main_file))
{
if(help)
{
}
else
{
- IO::print(IO::cerr, "No build info here.\n");
+ IO::print(IO::cerr, "The file %s does not exist.\n", main_file);
return 1;
}
}
+ load_build_file(main_file);
+
if(help)
{
usage(0, "builder", false);
}
}
-int Builder::load_build_file(const FS::Path &fn)
+void Builder::load_build_file(const FS::Path &fn)
{
- if(!FS::exists(fn))
- return -1;
-
IO::BufferedFile in(fn.str());
logger.log("files", format("Reading %s", fn));
DataFile::Parser parser(in, fn.str());
Loader loader(*this);
loader.load(parser);
-
- return 0;
}
bool Builder::prepare_build()
/** Loads a build file. Returns 0 on success or -1 if the file could not be
opened. */
- int load_build_file(const Msp::FS::Path &);
+ void load_build_file(const Msp::FS::Path &);
private:
/** Prepares packages and targets for building. Returns true if everything