Skip to content

Commit

Permalink
Move config and storage to ~/taskbook/
Browse files Browse the repository at this point in the history
Note that this is not truly respecting the XDG Base Dir Spec
  • Loading branch information
alichtman committed Mar 25, 2020
1 parent 202bb8d commit 6b9abc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ const path = require('path');
const pkg = require('../package.json');

const {join} = path;
const {env} = process;
const {default: defaultConfig} = pkg.configuration;

class Config {
constructor() {
this._configFile = join(os.homedir(), '.taskbook.json');

let config_home = join(env.XDG_CONFIG_HOME || join(os.homedir(), '.config'));
this._configFile = join(join(config_home, 'taskbook'), 'taskbook.json')
this._ensureConfigFile();
}

Expand Down
4 changes: 2 additions & 2 deletions src/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Storage {

get _mainAppDir() {
const {taskbookDirectory} = config.get();
const defaultAppDirectory = join(os.homedir(), '.taskbook');
const defaultAppDirectory = join(os.homedir(), 'taskbook');

if (!taskbookDirectory) {
return defaultAppDirectory;
Expand All @@ -33,7 +33,7 @@ class Storage {
process.exit(1);
}

return join(taskbookDirectory, '.taskbook');
return join(taskbookDirectory, 'taskbook');
}

_ensureMainAppDir() {
Expand Down

0 comments on commit 6b9abc5

Please sign in to comment.