Hi JCL,
a)
I'm afraid there is no build-in '(get-current-path)' function that
would make it easier.
Such a function is hard to support on multiple platforms.
However, I quickly implemented this function for you, supporting
Windows, POSIX (Linux/OSX):
#if IO_FUNCTIONS
static void *GetCurrentPathFunction(void *theEnv) {
#if UNIX_V || UNIX_7 || LINUX || DARWIN || MAC_XCD || MAC_MCW || GENERIC
char buffer[PATH_MAX];
buffer[0] = '\0';
getcwd(buffer, PATH_MAX);
#elif WIN_MVC || WIN_BTC || WIN_GCC
char buffer[MAX_PATH];
char *curr, *end;
buffer[0] = '\0';
GetModuleFileNameA(NULL,buffer,sizeof(buffer));
curr = buffer;
end = NULL;
while (curr[0] != '\0') {
if (curr[0] == '\\') {
/* Skip folder */
end = ++curr;
} else if (curr[0] == ':') {
/* Skip drive letter */
curr++;
if (curr[0] == '\\') {
end = ++curr;
}
} else {
curr++;
}
}
if (end != NULL) {
end[0] = '\0';
}
#else
char buffer[1];
buffer[0] = '\0';
#endif
return (SYMBOL_HN *) EnvAddSymbol(theEnv,buffer);
}
#endif
#if IO_FUNCTIONS
/*==================================================*/
/* Get the fully qualified path for the executable. */
/* Format: (get-current-path) */
/*==================================================*/
EnvDefineFunction2(theEnv,"get-current-path",'s',PTIEF
GetCurrentPathFunction, "get-current-path", "00");
#endif
b) I wondering what you don't like about this method?
c) Alternatively: use a global variable and set it before calling your
function. However, I would prefer method b in this case.
2012/5/6 JCL <
afgha...@mypacks.net>:
> --
> You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
> To post to this group, send email to
CLIP...@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/CLIPSESG?hl=en
>
> --> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
> Visit this group at
http://groups.google.com/group/CLIPSESG?hl=en
> Click on "Edit my membership" link.
> Select the "No Email" radio button.
> Click the "Save these settings" button.
>
> --> IF YOU WANT TO UNSUBSCRIBE <--
> Visit this group at
http://groups.google.com/group/CLIPSESG?hl=en
> Sign in
> Click on "Edit my membership" link.
> Click the "Unsubscribe" button.
> Note: This appears to be the most reliable way to unsubscribe
>
> Alternately, send email to
CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.