aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2023-02-06 09:43:29 +1000
committerSteve Bennett <steveb@workware.net.au>2023-02-13 10:44:10 +1000
commitb8f4c28ae643f1661c93b8fa19b7df6ac67fa8f6 (patch)
treeff01b476a1261eb93bc0b4c2059eaa87c6642365
parent6bdec684893b766f247e365fbb8fad7e37b2864b (diff)
downloadjimtcl-b8f4c28ae643f1661c93b8fa19b7df6ac67fa8f6.zip
jimtcl-b8f4c28ae643f1661c93b8fa19b7df6ac67fa8f6.tar.gz
jimtcl-b8f4c28ae643f1661c93b8fa19b7df6ac67fa8f6.tar.bz2
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 <steveb@workware.net.au>
-rw-r--r--auto.def5
-rw-r--r--jim-file.c4
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);