cdp-saw 1.1.4 → 1.1.5
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/index.js +22 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -65,9 +65,29 @@ function selectBestKey(isHighCost) {
|
|
|
65
65
|
return bestKey;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function findTestpadPath() {
|
|
69
|
+
const commonPaths = [
|
|
70
|
+
process.env.LOCALAPPDATA ? path.join(process.env.LOCALAPPDATA, 'Programs', 'testpad', 'testpad.exe') : null,
|
|
71
|
+
process.env.ProgramFiles ? path.join(process.env.ProgramFiles, 'testpad', 'testpad.exe') : null,
|
|
72
|
+
process.env['ProgramFiles(x86)'] ? path.join(process.env['ProgramFiles(x86)'], 'testpad', 'testpad.exe') : null,
|
|
73
|
+
'C:\\Program Files\\testpad\\testpad.exe',
|
|
74
|
+
'C:\\Program Files (x86)\\testpad\\testpad.exe'
|
|
75
|
+
];
|
|
76
|
+
for (const p of commonPaths) {
|
|
77
|
+
if (p && fs.existsSync(p)) return p;
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const TESTPAD_PATH = findTestpadPath();
|
|
83
|
+
if (!TESTPAD_PATH) {
|
|
84
|
+
console.error('[cdp] ❌ ERROR: testpad.exe not found in common locations!');
|
|
85
|
+
console.error('[cdp] Please ensure Testpad is installed or provide the path manually.');
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
|
|
68
89
|
function launchBrowser() {
|
|
69
|
-
const
|
|
70
|
-
const p = path.join(userProfile, "AppData\\Local\\Programs\\testpad\\testpad.exe");
|
|
90
|
+
const p = TESTPAD_PATH;
|
|
71
91
|
if (fs.existsSync(p)) {
|
|
72
92
|
console.log(`[cdp] 🚀 Launching: ${p}`);
|
|
73
93
|
cleanupProcesses();
|