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(){
2121 }
2222
2323 this . orderedPaths = [
24- path . join ( os . homedir ( ) , '.browserstack' ) ,
24+ path . join ( this . homedir ( ) , '.browserstack' ) ,
2525 process . cwd ( ) ,
2626 os . tmpdir ( )
2727 ] ;
@@ -82,6 +82,28 @@ function LocalBinary(){
8282 return false ;
8383 }
8484 } ;
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+ }
85107}
86108
87109module . exports = LocalBinary ;
You can’t perform that action at this time.
0 commit comments