Commit baee919
Use path APIs instead of MAIN_SEPARATOR splitting in app/build.rs (#14563)
## Description
`get_build_profile_name()` in `app/build.rs` derived the Cargo profile
name by reading `OUT_DIR` as a plain string and splitting it on
`std::path::MAIN_SEPARATOR`. Choosing the separator by hand is brittle,
so this replaces the string split with real path handling: `OUT_DIR`
becomes a `PathBuf` and the profile directory is resolved with
`ancestors().nth(3)` + `Path::file_name()`.
Behavior is unchanged for the standard `OUT_DIR` layout
(`.../<profile>/build/<crate>-<hash>/out` -> `<profile>`), and the
path-based version additionally tolerates a trailing separator, which
the old split did not.
Per the requester, no comments and no tests were added, and the change
is limited to that one function.
## Linked Issue
[APP-5072](https://linear.app/warpdotdev/issue/APP-5072/use-path-apis-instead-of-main-separator-string-splitting-in-appbuildrs)
## Testing
Testing-exempt: the requester explicitly asked for no new tests, and
this is a behavior-preserving refactor of a build-script helper.
Verification performed instead:
- Equivalence check: compiled and ran a standalone harness with the old
and new implementations side by side over representative `OUT_DIR`
values
(`/code/core/target/cli/build/my-build-info-9f91ba6f99d7a061/out`,
`.../debug/build/warp-abc123/out`, `.../release-lto/build/warp-1/out`) —
both return the same profile name (`cli`, `debug`, `release-lto`). With
a trailing separator the old split returns `build` while the new
path-based version still returns `cli`.
- `cargo fmt -p warp -- --check` passes.
- `cargo check -p warp` passes — the build script compiles and runs
(`target/debug/build/warp-*/output` produced).
- `cargo clippy -p warp --all-targets --tests -- -D warnings` passes.
- No UI surface (build script only), so no computer-use verification
applies.
- [ ] I have manually tested my changes locally with `./script/run`
## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
Originating thread:
https://warpdev.slack.com/archives/C0BDQDW8V5E/p1785445025743429
CHANGELOG-NONE
<!-- factory-agent:
{"source":"factory-agent","task_id":"APP-5072","task_source":"linear","task_url":"https://linear.app/warpdotdev/issue/APP-5072/use-path-apis-instead-of-main-separator-string-splitting-in-appbuildrs","oz_run_id":"019fb544-9a9c-7b19-bf65-bee1c2de61bc","repo":"warpdotdev/warp"}
-->
Co-authored-by: Andy <andy@warp.dev>1 parent 2c86dce commit baee919
1 file changed
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
225 | 226 | | |
226 | | - | |
| 227 | + | |
| 228 | + | |
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
| |||
0 commit comments