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

Add example locations #16

Merged
merged 9 commits into from
Mar 8, 2021
Merged
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ Directory for data files.

Directory for config files.

Example locations (with the default `nodejs` [suffix](#suffix)):

- macOS: `~/Library/Preferences/MyApp-nodejs`
- Windows: `%APPDATA%\MyApp-nodejs\Config`
Copy link
Owner

Choose a reason for hiding this comment

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

Would be useful to also show an example of the full resolved path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My rationale for %APPDATA% is that it's better / easier to read than C:\Users\sindresorhus\AppData\Roaming (and even that depends on the Windows version I believe).

While we're at it, do you think ~ is fine? I prefer ~/Library/Preferences/MyApp-nodejs over /Users/sindresorhus/Library/Preferences/MyApp-nodejs but it's a similar issue as with %APPDATA%. Overall, my preference is towards shorter, more generic examples where possible.

Copy link
Owner

Choose a reason for hiding this comment

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

My rationale for %APPDATA% is that it's better / easier to read

I agree. I meant just showing an example of the resolved path afterwards.

While we're at it, do you think ~ is fine?

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, so what do you mean by "resolved path"? paths.config is a directory so examples like ~/Library/Preferences/MyApp-nodejs or %APPDATA%\MyApp-nodejs\Config are already fully resolved, aren't they?

Copy link
Owner

Choose a reason for hiding this comment

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

From experience, people know what ~ resolves to, but it's not always clear what %APPDATA resolves to.

Copy link
Owner

Choose a reason for hiding this comment

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

- macOS: `~/Library/Preferences/MyApp-nodejs`
- Windows: `%APPDATA%\MyApp-nodejs\Config` (Example: `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
- Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I've changed the format and also documented the other properties, see readme.md as of f4f8c05.

It would be great if you could double-check the actual values, for example, I'm not that sure that .temp examples are fully correct on Windows & Linux. But if you could review the other as well that would be great 🙏.

After this is checked, I'll be happy to update the .d.ts file as well.

Copy link
Owner

Choose a reason for hiding this comment

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

for example, I'm not that sure that .temp examples are fully correct on Windows & Linux

It's all in the code. I don't have a Linux or Windows system to test on right now. The Linux one for temp looks incorrect from a quick look as (per the code) it should include the username.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to work with the source code closely, for all the examples, I hope that .temp is the only one I missed – you're right, it should contain username. For example, https://runkit.com/embed/kefcnj8b9f7d.

Fixed in ff5b24a.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You also need to update the docs in index.d.ts

Done in 2fff90a.

- Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)

### paths.cache

Directory for non-essential data files.
Expand Down