wstp-node 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/wstp_dir.js +49 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wstp-node",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Native Node.js addon for Wolfram/Mathematica WSTP — kernel sessions with evaluation queue, streaming Print/messages, Dialog subsessions, and side-channel WstpReader",
|
|
5
5
|
"main": "build/Release/wstp.node",
|
|
6
6
|
"types": "index.d.ts",
|
package/scripts/wstp_dir.js
CHANGED
|
@@ -22,24 +22,59 @@ function resolve () {
|
|
|
22
22
|
|
|
23
23
|
// ── 2. Windows ──────────────────────────────────────────────────────────
|
|
24
24
|
if (process.platform === 'win32') {
|
|
25
|
-
const base = 'C:\\Program Files
|
|
26
|
-
|
|
27
|
-
try
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const base = process.env.PROGRAMFILES || 'C:\\Program Files';
|
|
26
|
+
|
|
27
|
+
// Wolfram products to try, in priority order
|
|
28
|
+
const products = [
|
|
29
|
+
'Wolfram Research\\Wolfram Engine',
|
|
30
|
+
'Wolfram Research\\Mathematica',
|
|
31
|
+
'Wolfram Research\\WolframEngine',
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
for (const product of products) {
|
|
35
|
+
const productDir = path.join(base, product);
|
|
36
|
+
let entries;
|
|
37
|
+
try { entries = fs.readdirSync(productDir); } catch (e) { continue; }
|
|
38
|
+
|
|
39
|
+
// Find version subfolders (e.g. "14.2", "13.1") — any dir starting with a digit
|
|
40
|
+
const versions = entries
|
|
41
|
+
.filter(d => {
|
|
42
|
+
if (!/^\d/.test(d)) return false;
|
|
43
|
+
try { return fs.statSync(path.join(productDir, d)).isDirectory(); } catch (e) { return false; }
|
|
44
|
+
})
|
|
30
45
|
.sort()
|
|
31
46
|
.reverse();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
|
|
48
|
+
if (!versions.length) {
|
|
49
|
+
// Help diagnose: show what IS there
|
|
50
|
+
process.stderr.write(
|
|
51
|
+
`wstp_dir: found "${productDir}" but no version subfolder.\n` +
|
|
52
|
+
` Contents: ${entries.join(', ') || '(empty)'}\n`
|
|
53
|
+
);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const wstp = path.join(
|
|
58
|
+
productDir, versions[0],
|
|
59
|
+
'SystemFiles', 'Links', 'WSTP', 'DeveloperKit',
|
|
60
|
+
'Windows-x86-64', 'CompilerAdditions'
|
|
36
61
|
);
|
|
62
|
+
if (!fs.existsSync(path.join(wstp, 'wstp.h')) &&
|
|
63
|
+
!fs.existsSync(path.join(wstp, 'wstp64i4s.lib'))) {
|
|
64
|
+
process.stderr.write(
|
|
65
|
+
`wstp_dir: WSTP DeveloperKit not found at expected path:\n ${wstp}\n`
|
|
66
|
+
);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
return wstp;
|
|
37
70
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
|
|
72
|
+
throw new Error(
|
|
73
|
+
`WSTP DeveloperKit not found.\n` +
|
|
74
|
+
`Tried under "${base}" for: ${products.join(', ')}\n\n` +
|
|
75
|
+
`Set WSTP_DIR to your CompilerAdditions folder, e.g.:\n` +
|
|
76
|
+
` set WSTP_DIR=C:\\Program Files\\Wolfram Research\\Wolfram Engine\\14.2\\SystemFiles\\Links\\WSTP\\DeveloperKit\\Windows-x86-64\\CompilerAdditions\n` +
|
|
77
|
+
`then run npm install again.`
|
|
43
78
|
);
|
|
44
79
|
}
|
|
45
80
|
|