Add ".wren" to modules in the embedder.

This commit is contained in:
Bob Nystrom
2015-02-06 11:52:05 -08:00
parent bb647d4247
commit 2005e1e0a2
10 changed files with 17 additions and 17 deletions
+3 -2
View File
@@ -52,13 +52,14 @@ static char* readFile(const char* path)
static char* readModule(WrenVM* vm, const char* module)
{
// The module path is relative to the root directory.
// The module path is relative to the root directory and with ".wren".
size_t rootLength = strlen(rootDirectory);
size_t moduleLength = strlen(module);
size_t pathLength = rootLength + moduleLength;
size_t pathLength = rootLength + moduleLength + 5;
char* path = malloc(pathLength + 1);
memcpy(path, rootDirectory, rootLength);
memcpy(path + rootLength, module, moduleLength);
memcpy(path + rootLength + moduleLength, ".wren", 5);
path[pathLength] = '\0';
FILE* file = fopen(path, "rb");
-1
View File
@@ -1174,7 +1174,6 @@ Value wrenImportModule(WrenVM* vm, const char* name)
return OBJ_VAL(moduleFiber);
}
static void defineMethod(WrenVM* vm, const char* className,
const char* methodName, int numParams,
WrenForeignMethodFn methodFn, bool isStatic)