From 5f0a2ba21c1901947dd60733eebf889cfb1e509a Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Tue, 24 Feb 2015 19:47:17 -0800 Subject: [PATCH] Just use a normal relative path to import relative to the cwd. --- src/main.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main.c b/src/main.c index 042ab0f3..7ab3a044 100644 --- a/src/main.c +++ b/src/main.c @@ -3,22 +3,16 @@ #include #include #include -#ifdef _MSC_VER - #include - #define getcwd _getcwd -#else - #include -#endif #include "wren.h" #define MAX_LINE_LENGTH 1024 // TODO: Something less arbitrary. +#define MAX_PATH_LENGTH 2024 // TODO: Something less arbitrary. // This is the source file for the standalone command line interpreter. It is // not needed if you are embedding Wren in an application. -char buffer[2048] = { '\0' }; -char* rootDirectory = buffer; +char rootDirectory[MAX_PATH_LENGTH]; static void failIf(bool condition, int exitCode, const char* format, ...) { @@ -145,7 +139,8 @@ static int runRepl(WrenVM* vm) printf("\\\\/\"-\n"); printf(" \\_/ wren v0.0.0\n"); - rootDirectory = getcwd(buffer, 2048); + // Import relative to the current directory. + rootDirectory[0] = '\0'; char line[MAX_LINE_LENGTH];