Skip to content

Feature: Custom Working Directory #1543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

georgenavarro
Copy link
Contributor

I wanted the ability to set the current working directory in the run action:

Screenshot 2025-04-18 at 9 17 34 PM

XcodeProj already supports this so I just added two new properties to Scheme.Run so that they can be passed to XCScheme.LaunchAction during the generation process.

@@ -523,6 +530,8 @@ extension Scheme.Run: JSONObjectConvertible {
}
customLLDBInit = jsonDictionary.json(atKeyPath: "customLLDBInit")
macroExpansion = jsonDictionary.json(atKeyPath: "macroExpansion")
customWorkingDirectory = jsonDictionary.json(atKeyPath: "customWorkingDirectory")
useCustomWorkingDirectory = jsonDictionary.json(atKeyPath: "useCustomWorkingDirectory") ?? Scheme.Run.useCustomWorkingDirectoryDefault
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to write these values in toJSONValue as well

Comment on lines 358 to 359
customWorkingDirectory: scheme.run?.customWorkingDirectory,
useCustomWorkingDirectory: scheme.run?.useCustomWorkingDirectory ?? Scheme.Run.useCustomWorkingDirectoryDefault,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could drop the useCustomWorkingDirectory property entirely and use a non nil value of customWorkingDirectory for this. What are your thoughts? Do you have need to set these separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't have that need so I'll apply your suggestions 👍🏼

@georgenavarro
Copy link
Contributor Author

@yonaskolb I've applied your suggestions and added a check to make sure that useCustomWorkingDirectory is properly generated when the customWorkingDirectory is present.

@yonaskolb yonaskolb merged commit 3251691 into yonaskolb:master Jul 22, 2025
3 checks passed
@georgenavarro georgenavarro deleted the feature/custom-working-directory branch July 22, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants