forked from ground/cground
Bug fixes
This commit is contained in:
@@ -1587,25 +1587,28 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
|
|||||||
char path[1024];
|
char path[1024];
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
|
// care about mac and windows later
|
||||||
|
char* extension = "so";
|
||||||
|
|
||||||
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.%s", envPath, libName, extension);
|
||||||
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.%s", libName, extension);
|
||||||
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.%s", libName, extension);
|
||||||
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 external library: %s", libName);
|
snprintf(errorMsg, sizeof(errorMsg), "Could not find external library: %s, in path: %s", libName, path);
|
||||||
runtimeError(FIXME, errorMsg, in, currentInstruction);
|
runtimeError(FIXME, errorMsg, in, currentInstruction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user