Skip to content

Windows absolute paths not supported #131

@superle3

Description

@superle3

Description

using absolute paths on windows doesn't work

To reproduce

Set the PDFVIEWER environment variable to an absolute path like C:\Program Files\SumatraPDF\SumatraPDF.exe
and
run the following in powershell

echo $env:PDFVIEWER
texdoc latex

get output

C:\Program Files\SumatraPDF\SumatraPDF.exe
'C' is not recognized as an internal or external command,
operable program or batch file.
texdoc error: Failed to execute: C "c:\texlive\2024\texmf-dist\doc\latex\latex-doc-ptr\latex-doc-ptr.pdf"

Additional info

See the code below

-- viewers
local function set_config_viewer_from_vars(key, vars)
for _, var in ipairs(vars) do
local value = os.getenv(var)
-- support colon-separated list
value = value and string.gmatch(value, '([^:]+)')()
if value then
set_config_element(key, value, {src='env', name=var})
end
end
end

value = value and string.gmatch(value, '([^:]+)')() only works for unix and not windows.
If on windows (not wsl) value = value and string.gmatch(value, '([^;]+)')() / ; should be used instead.

Workaround

set PDFVIEWER=sumatrapdf and add C:\Program Files\SumatraPDF to PATH environment variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions