Skip to content
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

Fix alternative xcode paths #542

Merged
merged 5 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/docs/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ Here is what you can try when the extension got stuck on some errors:
If you need to install an older version of an IDE, you can do so by navigating to the cogwheel menu next to the "install" button in the market place.

<img width="698" alt="download-older-version" src="/img/docs/marketplace_install_older_version.png"/>

### -sec-num- Configureing Alternative Xcode Versions

If you are using alternative Xcode version ( e.g. xcode-beta, ["xcodes"](https://www.xcodes.app/) IDE will only work if xcode-select points to the correct directory to set it up run: `xcode-select --switch ${PathToYourXCode}/Contents/Developer`
15 changes: 14 additions & 1 deletion packages/vscode-extension/src/devices/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@ export class Preview implements Disposable {
);

Logger.debug(`Launch preview ${simControllerBinary} ${this.args}`);
const subprocess = exec(simControllerBinary, this.args, { buffer: false });

let simControllerBinaryEnv: { DYLD_FRAMEWORK_PATH: string } | undefined;

if (Platform.OS === "macos") {
const { stdout } = await exec("xcode-select", ["-p"]);
const DYLD_FRAMEWORK_PATH = path.join(stdout, "Library", "PrivateFrameworks");
Logger.debug(`Setting DYLD_FRAMEWORK_PATH to ${DYLD_FRAMEWORK_PATH}`);
simControllerBinaryEnv = { DYLD_FRAMEWORK_PATH };
Copy link
Member

Choose a reason for hiding this comment

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

can we add some logging here, would be good for troubleshooting in case xcode-select prints out some trash data

}

const subprocess = exec(simControllerBinary, this.args, {
buffer: false,
env: simControllerBinaryEnv,
});
this.subprocess = subprocess;

return new Promise<string>((resolve, reject) => {
Expand Down
Loading