1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-16 15:24:10 +02:00

Preserve working directory with -run

This commit is contained in:
Brian Fiete 2025-03-21 16:41:53 -04:00
parent c25f750bd5
commit 1a4f0b1b4a

View file

@ -25,6 +25,7 @@ namespace BeefBuild
public bool mWantsGenerate = false; public bool mWantsGenerate = false;
public bool mHandledVerb; public bool mHandledVerb;
public String mRunArgs ~ delete _; public String mRunArgs ~ delete _;
public String mStartingDirectory = new .() ~ delete _;
MainVerbState mMainVerbState; MainVerbState mMainVerbState;
/*void Test() /*void Test()
@ -57,6 +58,8 @@ namespace BeefBuild
public override void Init() public override void Init()
{ {
Directory.GetCurrentDirectory(mStartingDirectory);
GetVersionInfo(var exeTime); GetVersionInfo(var exeTime);
if (mVerbosity == .Default) if (mVerbosity == .Default)
@ -412,9 +415,6 @@ namespace BeefBuild
{ {
if ((mVerb == .Run) && (!mDidRun) && (!mFailed)) if ((mVerb == .Run) && (!mDidRun) && (!mFailed))
{ {
let curPath = scope String();
Directory.GetCurrentDirectory(curPath);
let workspaceOptions = gApp.GetCurWorkspaceOptions(); let workspaceOptions = gApp.GetCurWorkspaceOptions();
let options = gApp.GetCurProjectOptions(mWorkspace.mStartupProject); let options = gApp.GetCurProjectOptions(mWorkspace.mStartupProject);
let targetPaths = scope List<String>(); let targetPaths = scope List<String>();
@ -423,7 +423,7 @@ namespace BeefBuild
if (targetPaths.IsEmpty) if (targetPaths.IsEmpty)
return; return;
ExecutionQueueCmd executionCmd = QueueRun(targetPaths[0], mRunArgs ?? "", curPath); ExecutionQueueCmd executionCmd = QueueRun(targetPaths[0], mRunArgs ?? "", mStartingDirectory);
executionCmd.mRunFlags |= .NoRedirect; executionCmd.mRunFlags |= .NoRedirect;
executionCmd.mIsTargetRun = true; executionCmd.mIsTargetRun = true;
mDidRun = true; mDidRun = true;