(
platform: string,
folderPath: string,
company: string,
name: string,
id: string,
)
| 255 | } |
| 256 | |
| 257 | async iMessageScript( |
| 258 | platform: string, |
| 259 | folderPath: string, |
| 260 | company: string, |
| 261 | name: string, |
| 262 | id: string, |
| 263 | ) { |
| 264 | |
| 265 | |
| 266 | |
| 267 | //if (platform === 'win32') { |
| 268 | const requirementsPath = getAssetPath('imessage_windows_reqs.txt'); |
| 269 | const requirements = fs |
| 270 | .readFileSync(requirementsPath, 'utf-8') |
| 271 | .split('\n'); |
| 272 | const imessagePath = path.join( |
| 273 | app.getPath('userData'), |
| 274 | 'exported_data', |
| 275 | company, |
| 276 | name, |
| 277 | ); |
| 278 | |
| 279 | let packagesInstalled = false; |
| 280 | for (const req of requirements) { |
| 281 | if (req.trim() !== '' && !fs.existsSync(imessagePath)) { |
| 282 | console.log('Installing', req.trim()); |
| 283 | try { |
| 284 | const { stdout, stderr } = await execAsync( |
| 285 | `python -m pip install ${req.trim()}`, |
| 286 | ); |
| 287 | console.log(`Installed ${req.trim()} successfully.`); |
| 288 | packagesInstalled = true; |
| 289 | } catch (installError) { |
| 290 | console.error(`Failed to install ${req.trim()}:`, installError); |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | if (packagesInstalled && !fs.existsSync(imessagePath)) { |
| 296 | fs.mkdirSync(imessagePath, { recursive: true }); |
| 297 | console.log(`Created directory: ${imessagePath}`); |
| 298 | } |
| 299 | |
| 300 | let isValidPassword = false; |
| 301 | let pythonProcess: ChildProcess; |
| 302 | |
| 303 | while (!isValidPassword) { |
| 304 | const password = await this.showPasswordPrompt(); |
| 305 | |
| 306 | if (password === null) { |
| 307 | throw new Error('Password input cancelled'); |
| 308 | } |
| 309 | |
| 310 | const scriptPath = getAssetPath('imessage_windows.py'); |
| 311 | |
| 312 | try { |
| 313 | const output = await new Promise<string>((resolve, reject) => { |
| 314 | pythonProcess = spawn( |
nothing calls this directly
no test coverage detected