From b8f4c28ae643f1661c93b8fa19b7df6ac67fa8f6 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Mon, 6 Feb 2023 09:43:29 +1000 Subject: windows: compatibility changes _fullpath isn't necessarily available, so check for it symlink() isn't useful enough on Windows to use Signed-off-by: Steve Bennett --- auto.def | 5 ++++- jim-file.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/auto.def b/auto.def index 8a21550..5d751f1 100644 --- a/auto.def +++ b/auto.def @@ -247,11 +247,14 @@ if {[cc-check-function-in-lib socket socket]} { } cc-check-functions ualarm lstat fork system select execvpe -cc-check-functions geteuid mkstemp realpath isatty +cc-check-functions geteuid mkstemp isatty cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist isascii cc-check-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes cc-check-functions shutdown socketpair link symlink fsync dup umask cc-check-functions localtime gmtime strptime clock_gettime +if {![cc-check-functions realpath]} { + cc-check-functions _fullpath +} cc-with {-includes math.h} { cc-check-decls isinf isnan diff --git a/jim-file.c b/jim-file.c index 7002832..4c8eabf 100644 --- a/jim-file.c +++ b/jim-file.c @@ -77,6 +77,8 @@ #if defined(__MINGW32__) || defined(__MSYS__) || defined(_MSC_VER) #define ISWINDOWS 1 +/* Even if we have symlink it isn't compatible enought to use */ +#undef HAVE_SYMLINK #else #define ISWINDOWS 0 #endif @@ -376,7 +378,7 @@ static int file_cmd_tail(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static char *JimRealPath(const char *restrict path, char *restrict resolved_path, size_t len) { -#if ISWINDOWS +#if defined(HAVE__FULLPATH) return _fullpath(resolved_path, path, len); #elif defined(HAVE_REALPATH) return realpath(path, resolved_path); -- cgit v1.1