VMD-L Mailing List
From: FX (fxcoudert_at_gmail.com)
Date: Sun Apr 26 2020 - 04:49:57 CDT
- Next message: John Stone: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Previous message: FX: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- In reply to: FX: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Next in thread: John Stone: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Reply: John Stone: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
> Would you accept a patch to add code in macosxvmdstart.C that auto-detects its presence in PATH? Currently, VMD expects VMDBABELBIN to be set, even if I have an obabel binary in my PATH. In my case, I have open babel installed and VMD won’t use it, which is not an ideal experience.
Here is code that works for me:
char *find_babel(void) {
char *token, *s, *path;
char tmp[1024];
path = s = strdup(getenv("PATH"));
while ((token = strsep(&s, ":"))) {
strcpy(tmp, token);
strcat(tmp, "/obabel");
if (access(tmp, X_OK) == 0) {
printf("Info) Found Open Babel binary at: %s\n", tmp);
free(path);
return strdup(tmp);
}
}
free(path);
return NULL;
}
and then at the end of macosxvmdstart():
if (!getenv("VMDBABELBIN")) {
char *babel = find_babel();
setenv("VMDBABELBIN", babel, 1);
free(babel);
}
That way it does not override an explicit environment variable, but will auto-detect babel if it’s installed in the PATH.
FX
- Next message: John Stone: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Previous message: FX: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- In reply to: FX: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Next in thread: John Stone: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Reply: John Stone: "Re: Early VMD 1.9.4 alpha builds for MacOS X Catalina (e.g., 10.15.4)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]