Skip to content

Commit

Permalink
docs ~ polish and add XDG references
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Jun 29, 2019
1 parent 8791401 commit 1696b46
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ declare namespace osPaths {

declare const osPaths: {
/**
Get paths for storing things like data, config, cache, etc.
Get OS-specific (and [XDG](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)-compatible) paths for storing things like data, config, cache, etc
Note: It only generates the path strings. It doesn't create the directories for you. You could use [`make-dir`](https://github.com/sindresorhus/make-dir) to create the directories.
Expand All @@ -55,10 +55,10 @@ declare const osPaths: {
const paths = osPaths('MyApp');
paths.data;
//=> '/home/rivy/.local/share/MyApp-nodejs'
//(*nix)=> '/home/rivy/.local/share/MyApp-nodejs'
paths.config
//=> '/home/rivy/.config/MyApp-nodejs'
//(*nix)=> '/home/rivy/.config/MyApp-nodejs'
```
*/
(name: string, options?: osPaths.Options): osPaths.Paths;
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ const homedir = os.homedir();
const tmpdir = os.tmpdir();
const {env} = process;

// XDG references
// # ref: <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html> @@ <https://archive.is/aAhtw>
// # ref: <https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html> @@ <https://archive.is/7N0TN>
// # ref: <https://wiki.archlinux.org/index.php/XDG_Base_Directory> @@ <https://archive.is/VdO9n>
// # ref: <https://wiki.debian.org/XDGBaseDirectorySpecification#state> @@ <http://archive.is/pahId>
// # ref: <https://ploum.net/207-modify-your-application-to-use-xdg-folders> @@ <https://archive.is/f43Gk>

const macos = name => {
const library = path.join(homedir, 'Library');
Expand Down
8 changes: 3 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

# os-paths [![Build Status](https://travis-ci.org/rivy/js.os-paths.svg?branch=master)](https://travis-ci.org/rivy/js.os-paths)

> Get paths for storing things like data, config, cache, etc
Uses the correct OS-specific paths. Most developers get this wrong.
> Get OS-specific (and [XDG](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)-compatible) paths for storing things like data, config, cache, etc
## Install

Expand All @@ -25,10 +23,10 @@ const osPaths = require('os-paths');
const paths = osPaths('MyApp');

paths.data;
//=> '/home/rivy/.local/share/MyApp-nodejs'
//(*nix)=> '/home/rivy/.local/share/MyApp-nodejs'

paths.config
//=> '/home/rivy/.config/MyApp-nodejs'
//(*nix)=> '/home/rivy/.config/MyApp-nodejs'
```

## API
Expand Down

0 comments on commit 1696b46

Please sign in to comment.