@@ -42,21 +42,30 @@ const searchEMMEPython = () => {
42
42
}
43
43
} ;
44
44
45
- const listEMMEPythonPaths = ( ) => {
46
- // Set Windows' python exe path postfix (e.g. Python27\python.exe)
47
- const p = getVersion ( versions . emme_python ) ;
48
- const pythonPathPostfix = `Python${ p . major } ${ p . minor } \\python.exe` ;
49
- // Search from environment variable "EMMEPATH"
50
- const envEmmePath = process . env . EMMEPATH || '' ;
51
- const envEmmePythonPath = path . join ( envEmmePath , pythonPathPostfix ) ;
52
- if ( envEmmePath && fs . existsSync ( envEmmePythonPath ) ) {
45
+ const checkEmmePythonEnv = ( ) => {
46
+ // Set Windows' python exe path postfix (e.g. Python27\python.exe)
47
+ const p = getVersion ( versions . emme_python ) ;
48
+ const pythonPathPostfix = `Python${ p . major } ${ p . minor } \\python.exe` ;
49
+ // Search from environment variable "EMMEPATH"
50
+ const envEmmePath = process . env . EMMEPATH || '' ;
51
+ const envEmmePythonPath = path . join ( envEmmePath , pythonPathPostfix ) ;
52
+ if ( envEmmePath && fs . existsSync ( envEmmePythonPath ) ) {
53
53
return [ true , envEmmePythonPath ] ;
54
- }
54
+ } else {
55
+ return [ false , null ] ;
56
+ }
57
+ }
55
58
56
- // Not found based on EMMEPATH, try guessing some common locations on Windows
59
+ const listEMMEPythonPaths = ( ) => {
57
60
const pythonVersion = getVersion ( versions . emme_python ) ;
58
61
59
62
const commonEmmePaths = [ ]
63
+ const pythonInstallations = [ ]
64
+
65
+ // Check if Windows python exe exists in environment variables
66
+ const [ hasPythonEnvInstallation , pythonEnvInstallation ] = checkEmmePythonEnv ( ) ;
67
+ if ( hasPythonEnvInstallation ) { pythonInstallations . push ( pythonEnvInstallation ) } ;
68
+
60
69
versions . emme_major_versions . forEach ( majorVersion => { commonEmmePaths . push ( `INRO\\Emme\\Emme ${ majorVersion } ` ) } )
61
70
62
71
const drives = [ 'C:' , 'D:' , 'E:' , 'F:' , 'G:' , 'H:' , 'I:' , 'J:' , '/' ] ;
@@ -75,7 +84,6 @@ const listEMMEPythonPaths = () => {
75
84
// Combine each (d)rive to all (p)aths, and merge results via reduce
76
85
return accumulator . concat ( paths . map ( ( p ) => `${ d } ${ p } ` ) ) ;
77
86
} , [ ] ) ;
78
- const pythonInstallations = [ ]
79
87
allPathCombinations . forEach ( ( pathCombination ) => {
80
88
const foundPythonEnv = hasPythonEnv ( pathCombination ) ;
81
89
if ( foundPythonEnv !== null ) {
@@ -133,7 +141,6 @@ function hasPythonEnv(basePath) {
133
141
}
134
142
} )
135
143
}
136
- console . log ( exePaths ) ;
137
144
return exePaths ;
138
145
}
139
146
0 commit comments