From b6e2a594e9d035d0c1f2d06fa3ff1edbc70a7ba4 Mon Sep 17 00:00:00 2001 From: DiamondNether90 Date: Mon, 16 Mar 2026 15:29:59 +1100 Subject: [PATCH] Auto-append .grnd file extension in use command --- src/interpreter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/interpreter.c b/src/interpreter.c index e9428c0..17c4169 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -1181,11 +1181,11 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop char buf[256]; switch (value->type) { case INT: { - snprintf(buf, sizeof(buf) * 256, "%" PRId64, value->data.intVal); + snprintf(buf, sizeof(buf), "%" PRId64, value->data.intVal); break; } case DOUBLE: { - snprintf(buf, sizeof(buf) * 256, "%f", value->data.doubleVal); + snprintf(buf, sizeof(buf), "%f", value->data.doubleVal); break; } case STRING: { @@ -1886,23 +1886,23 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop char* envPath = getenv("GROUND_LIBS"); if (envPath) { - snprintf(path, sizeof(path), "%s/%s", envPath, libName); + snprintf(path, sizeof(path), "%s/%s.grnd", envPath, libName); if (access(path, F_OK) == 0) found = 1; } if (!found) { - snprintf(path, sizeof(path), "/usr/lib/ground/%s", libName); + snprintf(path, sizeof(path), "/usr/lib/ground/%s.grnd", libName); if (access(path, F_OK) == 0) found = 1; } if (!found) { - snprintf(path, sizeof(path), "%s", libName); + snprintf(path, sizeof(path), "./%s.grnd", libName); if (access(path, F_OK) == 0) found = 1; } if (!found) { char errorMsg[1100]; - snprintf(errorMsg, sizeof(errorMsg), "Could not find library: %s", libName); + snprintf(errorMsg, sizeof(errorMsg), "Could not find library: %s.grnd", libName); runtimeError(FIXME, errorMsg, in, currentInstruction); }