fixed ${NSISDIR} on POSIX when makensis is called with an absolute path

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3542 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-05-08 13:05:35 +00:00
parent 890a83c2b1
commit c458fd50bc
3 changed files with 38 additions and 56 deletions

View file

@ -389,6 +389,33 @@ int wsprintf(char *s, const char *format, ...) {
va_end(val);
return res;
}
char *my_realpath(char *path)
{
#ifdef PATH_MAX
static char buffer[PATH_MAX];
#else
int path_max = pathconf(path, _PC_PATH_MAX);
if (path_max <= 0)
path_max = 4096;
char *buffer = (char *) malloc(path_max);
if (!buffer)
return path;
#endif
if (!realpath(path, buffer))
strcpy(buffer, path);
return buffer;
}
void my_free_realpath(char *path, char *buffer)
{
#if !defined(_WIN32) && !defined(PATH_MAX)
if (buffer != path)
free(buffer);
#endif
}
#endif
void *operator new(size_t size) {