Skip to content

Commit

Permalink
Simplify the XDG config fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 13, 2017
1 parent 76fea84 commit 66f605d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
'use strict';
const path = require('path');
const osTmpdir = require('os').tmpdir;
const os = require('os');
const fs = require('graceful-fs');
const osenv = require('osenv');
const mkdirp = require('mkdirp');
const uuid = require('uuid');
const xdgBasedir = require('xdg-basedir');
const writeFileAtomic = require('write-file-atomic');
const dotProp = require('dot-prop');
const uniqueString = require('unique-string');

const user = (osenv.user() || uuid.v4()).replace(/\\/g, '');
const configDir = xdgBasedir.config || path.join(osTmpdir(), user, '.config');
const configDir = xdgBasedir.config || path.join(os.tmpdir(), uniqueString());
const permissionError = 'You don\'t have access to this file.';
const defaultPathMode = 0o0700;
const writeFileOptions = {mode: 0o0600};
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"dot-prop": "^4.1.0",
"graceful-fs": "^4.1.2",
"mkdirp": "^0.5.0",
"osenv": "^0.1.0",
"uuid": "^3.0.1",
"unique-string": "^1.0.0",
"write-file-atomic": "^1.1.2",
"xdg-basedir": "^3.0.0"
},
Expand Down

0 comments on commit 66f605d

Please sign in to comment.