Commit 4beac2d
CheeseTree Developer
fix: normalize path separators in WSL remote sessions
When the extension runs on a non-Windows host (WSL remote, SSH remote)
but the configured journal base path is a Windows-style drive path such
as C:\Users\...\journal, the path components were concatenated with a
mix of backslashes and forward slashes. The result was a malformed path
like /C:\Users\...\journal/2026/05/20.md that VS Code could not resolve,
causing an empty buffer to be shown instead of the journal entry (#228).
Two-layer fix:
1. conf.ts – normalizeBasePathForRuntime: besides the existing /mnt/<drive>/...
conversion for explicit Windows drive paths, now also replaces stray
backslashes in non-drive POSIX paths so that any Windows-style separator
that slipped in via ${workspaceFolder} or similar variables is cleaned up
before the path is returned from getBasePath().
2. template-service.ts – getResolvedEntryPath / getResolvedNotesPath /
getResolvedWeeklyNotesPath / getWeekPathPattern: after all template
variables are substituted, replace any remaining backslashes with forward
slashes on non-Windows hosts before Path.normalize() runs. This acts as
a belt-and-suspenders guard so that a Windows-style base path that somehow
passes through getBasePath() unchanged cannot corrupt the final resolved
path string.1 parent 9a4d1a1 commit 4beac2d
2 files changed
Lines changed: 30 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
98 | 103 | | |
99 | 104 | | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
106 | 112 | | |
107 | 113 | | |
108 | 114 | | |
109 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
110 | 119 | | |
111 | 120 | | |
112 | 121 | | |
113 | | - | |
| 122 | + | |
| 123 | + | |
114 | 124 | | |
115 | 125 | | |
116 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
| |||
116 | 124 | | |
117 | 125 | | |
118 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
119 | 130 | | |
120 | 131 | | |
121 | 132 | | |
| |||
127 | 138 | | |
128 | 139 | | |
129 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
| |||
0 commit comments