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 settings path being incorrect when file is not under repo root #6707

Merged
merged 1 commit into from
Mar 15, 2018

Conversation

madhurig
Copy link
Contributor

@@ -181,7 +181,7 @@ async function execBuild() {
if ((options[i] === '--settings' || options[i] === '-s') && (i + 1) < options.length) {
i++; // increment to the file name
let suppliedSettingsXml: string = options[i];
tl.cp(path.join(tl.cwd(), suppliedSettingsXml), settingsXmlFile, '');
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain how resolve is better than join here? Is it because suppliedSettingsXml might be a full path?

Copy link
Contributor

@brcrista brcrista Mar 15, 2018

Choose a reason for hiding this comment

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

You can just use path.resolve(suppliedSettingsXml). resolve will prepend the current working directory to create an absolute path if suppliedSettingsXml is relative, or return suppliedSettingsXml if it is absolute.

Copy link
Member

Choose a reason for hiding this comment

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

tl.cwd() is not necessarily the current working directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jpricketMSFT: Yes, join doesn't work if the suppliedSettingsXml is a full path that is not under the cwd (see linked issue)
@brcrista : I think the way it is written is more readable :)

Copy link
Member

@jpricket jpricket left a comment

Choose a reason for hiding this comment

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

One question.

@madhurig madhurig merged commit 4ced5d2 into master Mar 15, 2018
@madhurig madhurig deleted the users/madhurig/mavensettingsfix branch March 15, 2018 14:26
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.

4 participants