Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Parse runtime/platform.conf

  • Loading branch information...
commit 5d2da0c3027b5a16f8f914b7a2421e0da4525a41 1 parent 97b145f
@drbrain drbrain authored
Showing with 16 additions and 0 deletions.
  1. +3 −0  vm/drivers/cli.cpp
  2. +12 −0 vm/environment.cpp
  3. +1 −0  vm/environment.hpp
View
3  vm/drivers/cli.cpp
@@ -29,6 +29,9 @@ static void load_root(Environment& env, std::string root) {
std::string path = root + "/" + line;
std::cout << "Loading directory: " << path << "\n";
env.load_directory(path);
+
+ std::cout << "Loading platform.conf: " << root << "\n";
+ env.load_platform_conf(root);
}
}
View
12 vm/environment.cpp
@@ -2,6 +2,7 @@
* VMs, as well as imports C data from the process into Rubyland. */
#include "environment.hpp"
+#include "config.hpp" // HACK rename to config_parser.hpp
#include "compiled_file.hpp"
#include "probes.hpp"
#include "builtin/string.hpp"
@@ -52,6 +53,17 @@ namespace rubinius {
}
}
+ void Environment::load_platform_conf(std::string dir) {
+ std::string path = dir + "/platform.conf";
+ std::ifstream stream(path.c_str());
+ if(!stream) {
+ std::string error = "Unable to load " + path + ", it is missing";
+ throw std::runtime_error(error);
+ }
+
+ state->user_config->import_stream(stream);
+ }
+
void Environment::run_file(std::string file) {
std::ifstream stream(file.c_str());
if(!stream) throw std::runtime_error("Unable to open file to run");
View
1  vm/environment.hpp
@@ -17,6 +17,7 @@ namespace rubinius {
void load_argv(int argc, char** argv);
void load_directory(std::string dir);
+ void load_platform_conf(std::string dir);
void run_file(std::string path);
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.