Open ahy-peter-zumtobel opened 1 month ago
.path
is the URI and /C:/path/to/directory
is a valid URI. The Window file explorer should be able to navigate to file:///C:/path/to/directory/file.txt
.
Having said that, we might want to use fsPath
(which is not available in VS web) instead of path
. Maybe it would be safer to use fsPath
only if we are not in a web environment.
Summary:
Newer versions of the extension have a bug in the path handling.
Description:
The value of the variable (path) {asciidoctorconfigdir} starts with a slash (example: '/c:/') so derived path can't be resolved.
Version: since 3.1.6
Environment: Version: 1.93.0 (user setup) Commit: 4849ca9bdf9666755eb463db297b69e5385090e3 Date: 2024-09-04T13:02:38.431Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631
Reproduce:
Related issues
Hints
Suspected corrupt file: asciidoctor-vscode/src/features/AsciidoctorConfig.ts
Suspected corrupt line of code:
72: const asciidoctorConfigParentDirectory = asciidoctorConfig.path.slice(0, asciidoctorConfig.path.lastIndexOf('/'))
-> ".path" delivers '/c:/' on Windows.Temporary workaround: Use version v3.1.5
Possible solution
For this specific case it would be sufficient to replace
const asciidoctorConfigParentDirectory = asciidoctorConfig.path.slice(0, asciidoctorConfig.path.lastIndexOf('/'))
withconst asciidoctorConfigParentDirectory = dir(asciidoctorConfig, workspaceFolderUri).fsPath
This has the intended behavior on Windows as well as on Linux. But I suspect a general path handling problem to be the root cause.