Created
September 16, 2011 11:23
-
-
Save takaokouji/1221898 to your computer and use it in GitHub Desktop.
.bundle Indeed of .so in MacRuby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/load.c b/load.c | |
index 06ca712..a1498b7 100644 | |
--- a/load.c | |
+++ b/load.c | |
@@ -186,6 +186,21 @@ check_path(const char *path, VALUE *out, int *type) | |
else if (strcmp(p + 1, "bundle") == 0) { | |
t = TYPE_BUNDLE; | |
} | |
+ else if (strcmp(p + 1, "so") == 0) { | |
+ const char *ext = "bundle"; | |
+ const long ext_len = strlen(ext); | |
+ const long len = p - path; | |
+ if (len + ext_len + 1 < PATH_MAX) { | |
+ char buf[PATH_MAX]; | |
+ strncpy(buf, path, PATH_MAX); | |
+ strcpy(buf + len + 1, ext); | |
+ buf[PATH_MAX - 1] = '\0'; | |
+ if (path_ok(buf, out)) { | |
+ *type = TYPE_BUNDLE; | |
+ return true; | |
+ } | |
+ } | |
+ } | |
if (t != 0 && path_ok(path, out)) { | |
*type = t; | |
return true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment