texlive[45750] Build/source/texk/kpathsea: tex-file.c: Again use a

commits+kakuto at tug.org commits+kakuto at tug.org
Sat Nov 11 09:54:52 CET 2017


Revision: 45750
          http://tug.org/svn/texlive?view=revision&revision=45750
Author:   kakuto
Date:     2017-11-11 09:54:52 +0100 (Sat, 11 Nov 2017)
Log Message:
-----------
tex-file.c: Again use a custom kpathsea_getlongpath() instead of GetLongPathName() (W32 only).

Modified Paths:
--------------
    trunk/Build/source/texk/kpathsea/ChangeLog
    trunk/Build/source/texk/kpathsea/tex-file.c

Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog	2017-11-11 07:54:13 UTC (rev 45749)
+++ trunk/Build/source/texk/kpathsea/ChangeLog	2017-11-11 08:54:52 UTC (rev 45750)
@@ -1,3 +1,9 @@
+2017-11-11  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	* tex-file.c: Again use a custom kpathsea_getlongpath()
+	instead of a standard API function GetLongPathName(), since
+	the latter sometimes does not work as desired (W32 only).
+
 2017-11-09  Karl Berry  <karl at freefriends.org>
 
 	* db.c (kpathsea_db_search_list): remove redundant test of `found'.

Modified: trunk/Build/source/texk/kpathsea/tex-file.c
===================================================================
--- trunk/Build/source/texk/kpathsea/tex-file.c	2017-11-11 07:54:13 UTC (rev 45749)
+++ trunk/Build/source/texk/kpathsea/tex-file.c	2017-11-11 08:54:52 UTC (rev 45750)
@@ -1011,8 +1011,8 @@
                             kpse_file_format_type format,
                             boolean must_exist, boolean all)
 {
-#if defined(_WIN32)
-  char tmpbuffer[512];
+#if defined(_WIN32) && !defined(__MINGW32__)
+  char tmpbuffer1[512], tmpbuffer2[512];
 #endif
   string *target, name;
   const_string *ext;
@@ -1136,22 +1136,23 @@
   }
 
   free (name);
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__)
   if (ret && *ret) {
-    size_t cplen;
     if (all) {
       for (count = 0; ret[count] != NULL; count++) {
-        if ((cplen = GetLongPathName (ret[count], tmpbuffer, 500))) {
-          if (cplen > strlen (ret[count]))
-            ret[count] = realloc (ret[count], cplen + 1);
-          strcpy (ret[count], tmpbuffer);
+        strcpy (tmpbuffer2, ret[count]);
+        if (kpathsea_getlongpath (kpse, tmpbuffer1, tmpbuffer2, 500)) {
+          if (strlen (tmpbuffer1) > strlen (ret[count]))
+            ret[count] = realloc (ret[count], strlen (tmpbuffer1) + 1);
+          strcpy (ret[count], tmpbuffer1);
         }
       }
     } else {
-      if ((cplen = GetLongPathName (*ret, tmpbuffer, 500))) {
-        if (cplen > strlen (*ret))
-          *ret = realloc (*ret, cplen + 1);
-        strcpy (*ret, tmpbuffer);
+      strcpy (tmpbuffer2, *ret);
+      if (kpathsea_getlongpath (kpse, tmpbuffer1, tmpbuffer2, 500)) {
+        if (strlen (tmpbuffer1) > strlen (*ret))
+          *ret = realloc (*ret, strlen (tmpbuffer1) + 1);
+        strcpy (*ret, tmpbuffer1);
       }
     } 
   }



More information about the tex-live-commits mailing list