cake-build / cake-build/cake

Add LaunchDirectory property to ICakeEnvironment

Open
#3,092 0 comments 0 reactions 0 assignees View on GitHub
Feature
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

`ICakeEnvironment.Environment` currently exposes `WorkingDirectory` which returns the directory path where the `.cake` script is located.

This issue is about adding a `LaunchDirectory` property to `ICakeEnvironment` that returns the original working directory where the Cake runner was invoked from, which could be a different folder than where the `.cake` script is located.

Examples:

| Cake Runner Call | WorkingDirectory (today) | LaunchDirectory (future) |
| --- | --- | --- |
| `C:\Projects>dotnet cake ProjectA\build\deploy.cake` | `C:\Projects\ProjectA\build` | `C:\Projects` |
| `C:\Projects\ProjectA>dotnet cake scripts\deploy.cake` | `C:\Projects\ProjectA\build` | `C:\Projects\ProjectA` |
| `C:\Projects\ProjectA\build>dotnet cake deploy.cake` | `C:\Projects\ProjectA\build` | `C:\Projects\ProjectA\build` |

---

Proposed by @mattleibow on discussion https://github.com/cake-build/cake/discussions/3076

Contributor guide

Open the contributing guide

Research direction

Start at the ICakeEnvironment.Environment interface and the Cake runner invocation described in the issue, then trace how WorkingDirectory is populated. Add the LaunchDirectory behavior so it preserves the directory where the runner was invoked, and verify it against the three command examples; the linked pull request may provide additional context.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.