forked from ground/ground-old
Auto-append .grnd file extension in use command
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user