Skip to content

Commit

Permalink
Fix alternative xcode paths (#542)
Browse files Browse the repository at this point in the history
This PR allows non standard xcode setups.

##### How to test: 
- change the name of xcode.app in your application directory
- update xcode-select using `xcode-select --switch
${PathToYourXCode}/Contents/Developer`
- run ide

---------

Co-authored-by: Filip <[email protected]>
  • Loading branch information
filip131311 and Filip committed Sep 18, 2024
1 parent 995697e commit 993fcae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/docs/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,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 @@ -24,7 +24,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 };
}

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

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

0 comments on commit 993fcae

Please sign in to comment.