File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ function LocalBinary(){
21
21
}
22
22
23
23
this . orderedPaths = [
24
- path . join ( os . homedir ( ) , '.browserstack' ) ,
24
+ path . join ( this . homedir ( ) , '.browserstack' ) ,
25
25
process . cwd ( ) ,
26
26
os . tmpdir ( )
27
27
] ;
@@ -82,6 +82,28 @@ function LocalBinary(){
82
82
return false ;
83
83
}
84
84
} ;
85
+
86
+ this . homedir = function ( ) {
87
+ if ( typeof os . homedir === 'function' ) return os . homedir ( ) ;
88
+
89
+ var env = process . env ;
90
+ var home = env . HOME ;
91
+ var user = env . LOGNAME || env . USER || env . LNAME || env . USERNAME ;
92
+
93
+ if ( process . platform === 'win32' ) {
94
+ return env . USERPROFILE || env . HOMEDRIVE + env . HOMEPATH || home || null ;
95
+ }
96
+
97
+ if ( process . platform === 'darwin' ) {
98
+ return home || ( user ? '/Users/' + user : null ) ;
99
+ }
100
+
101
+ if ( process . platform === 'linux' ) {
102
+ return home || ( process . getuid ( ) === 0 ? '/root' : ( user ? '/home/' + user : null ) ) ;
103
+ }
104
+
105
+ return home || null ;
106
+ }
85
107
}
86
108
87
109
module . exports = LocalBinary ;
You can’t perform that action at this time.
0 commit comments