| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The shell expands ~ in command-line arguments, but values read from config.yaml were passed to path.resolve as-is, so `user-data-dir: ~/.config/code-server-data` resolved to `<cwd>/~/.config/code-server-data`. Fixes coder#7051
There was a problem hiding this comment.
Fantastic thank you!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #7051
Summary
Expand a leading ~ in path options (such as user-data-dir and extensions-dir) so they work in config.yaml the same way they do on the command line.
Problem
The shell expands ~ in command-line arguments, but nothing expands it in values read from the config file. With
the value reaches path.resolve as-is (src/node/cli.ts#L469) and is resolved against the current working directory. Depending on where code-server is started, the result is <cwd>/~/.config/code-server-data or /~/.config/..., which leads to errors like:
Solution
As suggested in the issue ("it would be nice if we manually expand it when we read the config"), path options now go through a small expandTilde helper before path.resolve:
Because the expansion happens in parse, it covers every option marked path: true (user-data-dir, extensions-dir, builtin-extensions-dir, cert, cert-key, socket, i18n), whether it comes from the CLI or the config file. CLI values are already expanded by the shell, so the change is a no-op for them.
Changes
Before / After
config.yaml:
How to test
Testing done
Notes for reviewers