Honor the TMPDIR environment variable (#266)

When creating a temporary directory, use $TMPDIR as base directory if set, otherwise fall back to "/tmp".
This commit is contained in:
Quentin Minster 2020-09-29 23:45:27 +02:00 committed by GitHub
parent b08024b592
commit e6e6a79e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -791,7 +791,7 @@ local builtin_style, builtin_template = match_bang(args.style),match_bang(args.t
if builtin_style or builtin_template then
-- '!' here means 'use built-in templates'
local user = path.expanduser('~'):gsub('[/\\: ]','_')
local tmpdir = path.join(path.is_windows and os.getenv('TMP') or '/tmp','ldoc'..user)
local tmpdir = path.join(path.is_windows and os.getenv('TMP') or (os.getenv('TMPDIR') or '/tmp'),'ldoc'..user)
if not path.isdir(tmpdir) then
lfs.mkdir(tmpdir)
end