Skip to content

Commit 23a81ca

Browse files
committed
use os module to get homedir
1 parent b1977cd commit 23a81ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/api.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var fs = require('fs');
55
var path = require('path');
66
var request = require('request');
77
var crypto = require('crypto');
8+
var os = require('os');
89

910
function TestingBot(options) {
1011
this.options = options || {};
@@ -13,7 +14,7 @@ function TestingBot(options) {
1314

1415
if (!this.options.api_key || !this.options.api_secret) {
1516
try {
16-
var tbFile = path.join(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], '.testingbot');
17+
var tbFile = path.join(os.homedir(), '.testingbot');
1718
if (fs.statSync(tbFile).isFile() === true) {
1819
var data = fs.readFileSync(tbFile);
1920
if (data !== null) {

0 commit comments

Comments
 (0)