[texdoc] a patch for Windows

Akira Kakuto kakuto at w32tex.org
Thu Apr 29 11:48:29 CEST 2021


Dear texdoc maintainers,

On 2021/04/29 16:58, Akira Kakuto wrote:
> I greatly appreciate if you kindly apply texdoclib-search.tlu.diff
> at suitable time.

Please replace the previous texdoclib-search.tlu.diff by a newly
attached texdoclib-search.tlu.diff2.

Best,
Akira
-------------- next part --------------
--- texdoclib-search.tlu.orig	Thu Apr 29 18:42:06 2021
+++ texdoclib-search.tlu	Thu Apr 29 18:39:24 2021
@@ -453,13 +453,21 @@
 
 -- make sure a given directory exists, or return nil plus an error string
 local function mkdir_p(dir)
-    if lfs.isdir(dir) then return true end
+    if os.type == 'windows' and chgstrcp then
+        if lfs.isdir(chgstrcp.syscptoutf8(dir)) then return true end
+    else
+        if lfs.isdir(dir) then return true end
+    end
     local parent = texdoc.util.path_parent(dir)
     if parent then
         local ok, msg = mkdir_p(parent)
         if not ok then return nil, msg end
     end
-    return lfs.mkdir(dir)
+    if os.type == 'windows' and chgstrcp then
+        return lfs.mkdir(chgstrcp.syscptoutf8(dir))
+    else
+        return lfs.mkdir(dir)
+    end
 end
 
 local print_out_tlpinfo, get_doclist_tlpdb
@@ -538,7 +546,12 @@
 
 -- print out data from tlpdb in dofile()-able form
 print_out_tlpinfo = function(filename)
-    local fh = assert(io.open(filename, 'w'))
+    local fh
+    if os.type == 'windows' and chgstrcp then
+        fh = assert(io.open(chgstrcp.syscptoutf8(filename), 'w'))
+    else
+        fh = assert(io.open(filename, 'w'))
+    end
     local function printf(s, ...) fh:write(string.format(s, ...)) end
 
     -- s_meta


More information about the texdoc mailing list.