diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2021-12-20 19:11:21 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2021-12-20 19:17:31 +0100 |
| commit | 4a5c8c6ad2daec6649e283d3cc2385e7d93376be (patch) | |
| tree | e069f82216d46c98eae0f757ceed29774cafbbd3 | |
| parent | 5206946674c2f6b15d476eced4faa442e607e049 (diff) | |
| download | rust-4a5c8c6ad2daec6649e283d3cc2385e7d93376be.tar.gz rust-4a5c8c6ad2daec6649e283d3cc2385e7d93376be.zip | |
fix: Fix windows not finding the pdb file
| -rw-r--r-- | crates/rust-analyzer/src/bin/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index ef90610f856..567cdc48ef4 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs @@ -93,6 +93,18 @@ fn try_main() -> Result<()> { } fn setup_logging(log_file: Option<&Path>) -> Result<()> { + if cfg!(windows) { + // This is required so that windows finds our pdb that is placed right beside the exe. + // By default it doesn't look at the folder the exe resides in, only in the current working + // directory which we set to the project workspace. + // https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/general-environment-variables + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-syminitialize + if let Ok(path) = env::current_exe() { + if let Some(path) = path.parent() { + env::set_var("_NT_SYMBOL_PATH", path); + } + } + } if env::var("RUST_BACKTRACE").is_err() { env::set_var("RUST_BACKTRACE", "short"); } |
