Add ".wren" to modules in the embedder.
This commit is contained in:
+3
-2
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user