Commit f37eef1
Fix is_dependency_code for Windows
The previous check relied on string comparisons, which are not cross-platfom since Windows uses `\` and Unix uses `/`, so on Windows I was always seeing dependencies printed as if they're 1st-party code and couldn't easily filter them out.
Instead of comparing paths as strings, it's better to use `Path::starts_with` which automatically compares paths component-wise regardless of OS delimiter.
I've also changed the 3rd-party dependency check to use CARGO_HOME which is automatically provided by Cargo at build time and allows to precisely check for both dependencies from registries (.../.cargo/registry/src) and git dependencies (.../.cargo/git/checkouts) in one go.
I verified this fixes the issues I've been having with color-backtrace on my Windows project.1 parent e34327a commit f37eef1
1 file changed
+8
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
316 | 310 | | |
317 | 311 | | |
318 | 312 | | |
| |||
0 commit comments