[latex3-commits] [git/LaTeX3-latex3-l3build] master: some error management abspath (d951558)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed Feb 3 17:03:26 CET 2021
Repository : https://github.com/latex3/l3build
On branch : master
Link : https://github.com/latex3/l3build/commit/d95155861fe8ea160847715ee5c13e1dcd87f206
>---------------------------------------------------------------
commit d95155861fe8ea160847715ee5c13e1dcd87f206
Author: LAURENS Jérôme <jerome.laurens at u-bourgogne.fr>
Date: Wed Feb 3 13:50:41 2021 +0100
some error management abspath
>---------------------------------------------------------------
d95155861fe8ea160847715ee5c13e1dcd87f206
l3build-file-functions.lua | 12 ++++++++----
l3build.dtx | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/l3build-file-functions.lua b/l3build-file-functions.lua
index 1c20b13..c904742 100644
--- a/l3build-file-functions.lua
+++ b/l3build-file-functions.lua
@@ -171,12 +171,16 @@ function normalize_path(path)
end
-- Return an absolute path from a relative one
+-- Due to chdir, path must exist and be accessible.
function abspath(path)
local oldpwd = currentdir()
- chdir(path)
- local result = currentdir()
- chdir(oldpwd)
- return escapepath(gsub(result, "\\", "/"))
+ local ok, msg = chdir(path)
+ if ok then
+ local result = currentdir()
+ chdir(oldpwd)
+ return escapepath(gsub(result, "\\", "/"))
+ end
+ return ok, msg
end
function escapepath(path)
diff --git a/l3build.dtx b/l3build.dtx
index 490098b..bedbdfe 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -1616,7 +1616,7 @@
% |abspath(|\meta{target}|)|
% \end{syntax}
% Returns a string which gives the absolute location of the
-% \meta{target} directory.
+% \meta{target} directory. The \meta{target} directory must exist and be accessible.
% \end{function}
%
% \begin{function}{dirname()}
More information about the latex3-commits
mailing list.