forked from ground/ground
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];
|
char buf[256];
|
||||||
switch (value->type) {
|
switch (value->type) {
|
||||||
case INT: {
|
case INT: {
|
||||||
snprintf(buf, sizeof(buf) * 256, "%" PRId64, value->data.intVal);
|
snprintf(buf, sizeof(buf), "%" PRId64, value->data.intVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOUBLE: {
|
case DOUBLE: {
|
||||||
snprintf(buf, sizeof(buf) * 256, "%f", value->data.doubleVal);
|
snprintf(buf, sizeof(buf), "%f", value->data.doubleVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STRING: {
|
case STRING: {
|
||||||
@@ -1886,23 +1886,23 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
|
|||||||
char* envPath = getenv("GROUND_LIBS");
|
char* envPath = getenv("GROUND_LIBS");
|
||||||
|
|
||||||
if (envPath) {
|
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 (access(path, F_OK) == 0) found = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
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 (access(path, F_OK) == 0) found = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
snprintf(path, sizeof(path), "%s", libName);
|
snprintf(path, sizeof(path), "./%s.grnd", libName);
|
||||||
if (access(path, F_OK) == 0) found = 1;
|
if (access(path, F_OK) == 0) found = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
char errorMsg[1100];
|
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);
|
runtimeError(FIXME, errorMsg, in, currentInstruction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user