summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texdoc/functions.tlu
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf/scripts/texdoc/functions.tlu')
-rw-r--r--Master/texmf/scripts/texdoc/functions.tlu18
1 files changed, 14 insertions, 4 deletions
diff --git a/Master/texmf/scripts/texdoc/functions.tlu b/Master/texmf/scripts/texdoc/functions.tlu
index 22d44c9336a..26b8d2d4d0a 100644
--- a/Master/texmf/scripts/texdoc/functions.tlu
+++ b/Master/texmf/scripts/texdoc/functions.tlu
@@ -5,12 +5,10 @@ Distributed under the terms of the GNU GPL version 3 or later.
See texdoc.tlu for details.
--]]
+-- Load a private environment for this submodule (see texdoc.tlu).
local L = {}
load_env(L, {
- 'export_symbols',
- 'string', 'io', 'os', 'table', 'tostring',
- 'print', 'pairs', 'ipairs', 'tonumber',
- 'C',
+ 'io', 'os', 'print',
'config',
})
@@ -26,6 +24,17 @@ else
end
end
+-- remove the last direcory component of a path
+if os.type == 'windows' then
+ function path_parent(path)
+ return string.match(path, '^(.*)[\\/]')
+ end
+else
+ function path_parent(path)
+ return string.match(path, '^(.*)/')
+ end
+end
+
-- generic error display function (see the error_priority constant)
function err_print (lvl, msg)
-- be careful: maybe config.verbosity_level is not set yet
@@ -119,4 +128,5 @@ export_symbols(L, {
'win32_hook',
'parse_zip',
'print_usage',
+ 'path_parent',
})