Skip to content

fix: fall back to default logs path in getPath('logs') - #19653

Merged
codebytere merged 5 commits into
masterfrom
setpath-logs-default
Aug 19, 2019
Merged

codebytere merged 5 commits into
masterfrom
setpath-logs-default

Conversation

@codebytere

@codebytere codebytere commented Aug 6, 2019 •

Copy link
Copy Markdown
Member

Description of Change

Follow-up to #19545 (comment).

If users try to call app.getPath('logs') before they've called app.setAppLogsPath() then it would previously error. Apps that relied on getPath('log') to work would get an exception, which is not great API.

Now, calling app.getPath('logs') without having previously called app.setAppLogsPath() will result in a directory being created and set to /Library/Logs/YourAppName on macOS, and inside the userData directory on Linux and Windows.

This also adds a converter for base::Optional<T> such that we don't introduce the possibility for mate::Arguments* pollution a la https://xkcd.com/327.

cc @MarshallOfSound

Checklist

Release Notes

Notes: Fixed an issue where app.getPath('logs') would throw an error if the logs path was not previously set.

@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Aug 6, 2019
@codebytere
codebytere requested review from ckerr and jkleinsc August 7, 2019 17:01
@codebytere
codebytere force-pushed the setpath-logs-default branch from 0e2488d to aae5648 Compare August 7, 2019 22:12

@ckerr ckerr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The idea looks fine. A couple of nits in comments.

Comment thread shell/browser/api/atom_api_app.cc Resolved
Comment thread shell/browser/api/atom_api_app.cc Resolved
Comment thread docs/api/app.md Resolved
@codebytere
codebytere force-pushed the setpath-logs-default branch 7 times, most recently from b6996b1 to 6a17122 Compare August 13, 2019 21:10
Comment thread docs/api/app.md Resolved
Comment thread native_mate/native_mate/arguments.h Resolved

@MarshallOfSound MarshallOfSound left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh actually one final thing, can we put like a test for this somewhere 😆

@codebytere
codebytere force-pushed the setpath-logs-default branch from f3eada6 to 5b26197 Compare August 19, 2019 19:53
@codebytere

Copy link
Copy Markdown
Member Author

@MarshallOfSound should be all set now!

@codebytere
codebytere merged commit 1dc02e6 into master Aug 19, 2019
@release-clerk

release-clerk Bot commented Aug 19, 2019

Copy link
Copy Markdown

Release Notes Persisted

Fixed an issue where app.getPath('logs') would throw an error if the logs path was not previously set.

@codebytere
codebytere deleted the setpath-logs-default branch August 19, 2019 22:16
@trop

trop Bot commented Aug 19, 2019

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "6-0-x" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 19, 2019

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "7-0-x", please check out #19836

@trop

trop Bot commented Aug 26, 2019

Copy link
Copy Markdown
Contributor

A maintainer has manually backported this PR to "6-0-x", please check out #19955

return true;
}
T converted;
if (Converter<T>::FromV8(isolate, val, &converted)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@codebytere I just ran into this code when doing refactoring. I believe this should be if not otherwise the out would never be filled?

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