Skip to content

Instantly share code, notes, and snippets.

@takaokouji
Created October 11, 2011 14:04
Show Gist options
  • Save takaokouji/1278161 to your computer and use it in GitHub Desktop.
Save takaokouji/1278161 to your computer and use it in GitHub Desktop.
MacRuby requires <file>.rbo instead of <file>.rb when you write 'require "<file>.rb"' in your script and <file>.rbo was created recently
diff --git a/load.c b/load.c
index b070a12..bc00930 100644
--- a/load.c
+++ b/load.c
@@ -323,6 +323,15 @@ check_path(const char *path, VALUE *out, int *type)
// it's a valid one, then try to validate the path.
int t = 0;
if (strcmp(p + 1, "rb") == 0) {
+ if (rbo_enabled && strlen(path) < (PATH_MAX - 1)) {
+ char buf[PATH_MAX];
+ strcpy(buf, path);
+ strcat(buf, "o");
+ if (path_ok(buf, out)) {
+ *type = TYPE_RBO;
+ return true;
+ }
+ }
t = TYPE_RB;
}
else if (rbo_enabled && strcmp(p + 1, "rbo") == 0) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment