Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Add more freedom on Mac with different version of Arduino #375

Merged
merged 2 commits into from
Jul 19, 2017

Conversation

DeqingSun
Copy link
Contributor

On Mac Arduino app has to be called "Arduino.app". In some cases (include me) we add a version number to keep a bunch of Arduino due to compatibility issues.
This PR add a regex check when generating a path. If it already specify a Arduino app, no "Arduino.app" is added.

@msftclas
Copy link

@DeqingSun,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

@msftclas
Copy link

@DeqingSun, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, Microsoft Pull Request Bot

@@ -56,7 +56,11 @@ export class ArduinoSettings implements IArduinoSettings {

public get defaultExamplePath(): string {
if (os.platform() === "darwin") {
return path.join(this._arduinoPath, "Arduino.app/Contents/Java/examples");
if (this._arduinoPath.match(/Arduino.*\.app/)){
Copy link
Contributor

@testforstephen testforstephen Jul 18, 2017

Choose a reason for hiding this comment

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

5 Duplicate if logics.
Suggest to add a utility method resolveMacArduinoAppPath in src/common/util.ts. Then just need join "/Contents/xxx"

resolveMacArduinoAppPath(arduinoPath: string): string {
if (/Arduino.*\.app/.test(arduinoPath)) {
return arduinoPath;
} else {
return path.join(arduinoPath, "Arduino.app");
}
}

@testforstephen
Copy link
Contributor

@DeqingSun Thanks for fixing the issue. Your PR doesn't pass tslint check. Please run "gulp tslint" in local PC first and fix the tslint issues.

@testforstephen testforstephen merged commit 405d5bd into microsoft:master Jul 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants