Skip to content

Commit

Permalink
Merge pull request #7 from duncan-bayne/master
Browse files Browse the repository at this point in the history
Add FreeBSD support
  • Loading branch information
LinusU authored Jun 12, 2018
2 parents 051dd4c + 5672ad2 commit 9e0a2d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var os = require('os')
var path = require('path')
var homedir = require('os-homedir')

function linux (id) {
function posix (id) {
var cacheHome = process.env.XDG_CACHE_HOME || path.join(homedir(), '.cache')
return path.join(cacheHome, id)
}
Expand All @@ -18,11 +18,12 @@ function win32 (id) {

var implementation = (function () {
switch (os.platform()) {
case 'android':
case 'linux': return linux
case 'android': return posix
case 'darwin': return darwin
case 'freebsd': return posix
case 'linux': return posix
case 'win32': return win32
default: throw new Error('Your OS is currently not supported by node-cachedir.')
default: throw new Error('Your OS "' + os.platform() + '" is currently not supported by node-cachedir.')
}
}())

Expand Down
3 changes: 2 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ var homedir = require('os-homedir')
var proxyquire = require('proxyquire')

var platforms = [
['linux', homedir() + '/.cache/linusu'],
['darwin', homedir() + '/Library/Caches/linusu'],
['freebsd', homedir() + '/.cache/linusu'],
['linux', homedir() + '/.cache/linusu'],
['win32', homedir() + '/AppData/Local/linusu/Cache']
]

Expand Down

0 comments on commit 9e0a2d2

Please sign in to comment.