[texdoc] a patch for Windows
Akira Kakuto
kakuto at w32tex.org
Thu Apr 29 09:58:42 CEST 2021
Dear texdoc maintainers,
I found that texdoc does not work on windows if user name is non-ascii.
The reason is that my lfs for windows assumes that strings are in utf-8 encoding.
I considered a minimal patch: an attached texdoclib-search.tlu.diff.
I greatly appreciate if you kindly apply texdoclib-search.tlu.diff
at suitable time.
Best,
Akira
-------------- next part --------------
--- texdoclib-search.tlu.orig Thu Apr 29 16:33:36 2021
+++ texdoclib-search.tlu Thu Apr 29 16:28:36 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' 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' 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' 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.