@@ -60,11 +60,11 @@ export default class ProcessServer {
6060 }
6161 } ) ;
6262
63- for ( const [ pid , path , args ] of processesToScan ) {
63+ for ( const [ pid , path , args , _cwdPath = '' ] of processesToScan ) {
6464 const possiblePaths = this . _generatePossiblePaths ( path ) ;
6565
6666 for ( const { e, i, n } of DetectableDB ) {
67- if ( this . _matchExecutable ( e , possiblePaths , args ) ) {
67+ if ( this . _matchExecutable ( e , possiblePaths , args , _cwdPath ) ) {
6868 this . _handleDetectedGame ( i , n , pid , activeIds ) ;
6969 }
7070 }
@@ -95,7 +95,7 @@ export default class ProcessServer {
9595 }
9696
9797 const toCompare = [ ] ;
98- for ( let i = 0 ; i < splitPath . length ; i ++ ) {
98+ for ( let i = 0 ; i < splitPath . length || i === 1 ; i ++ ) {
9999 toCompare . push ( splitPath . slice ( - i ) . join ( '/' ) ) ;
100100 }
101101
@@ -111,10 +111,10 @@ export default class ProcessServer {
111111 return variations ;
112112 }
113113
114- _matchExecutable ( executables , possiblePaths , args ) {
114+ _matchExecutable ( executables , possiblePaths , args , cwdPath ) {
115115 if ( ! executables ) return false ;
116116 return executables . n . some ( name => {
117- const pathMatches = name [ 0 ] === '>' ? name . substring ( 1 ) === possiblePaths [ 0 ] : possiblePaths . some ( path => name === path ) ;
117+ const pathMatches = name [ 0 ] === '>' ? name . substring ( 1 ) === possiblePaths [ 0 ] : possiblePaths . some ( path => name === path || ` ${ cwdPath } / ${ path } ` . includes ( `/ ${ name } ` ) ) ;
118118 const argsMatch = ! executables . a || ( args && args . join ( " " ) . includes ( executables . a ) ) ;
119119 return pathMatches && argsMatch ;
120120 } ) ;
0 commit comments