()
| 450 | // Returns true when at least one file produced (or focused) a window, so |
| 451 | // the caller can skip opening a redundant default-vault window. |
| 452 | async function flushPendingFileOpens(): Promise<boolean> { |
| 453 | if (!app.isReady() || pendingFileOpens.length === 0) return false |
| 454 | const items = pendingFileOpens.splice(0) |
| 455 | let openedAny = false |
| 456 | for (const item of items) { |
| 457 | try { |
| 458 | if (await openMarkdownFileFromOS(item.absPath, item.reuseMainWindow)) { |
| 459 | openedAny = true |
| 460 | } |
| 461 | } catch (err) { |
| 462 | console.error('Failed to open markdown file', item.absPath, err) |
| 463 | } |
| 464 | } |
| 465 | return openedAny |
| 466 | } |
| 467 | |
| 468 | async function openMarkdownFileFromOS(absPath: string, reuseMainWindow: boolean): Promise<boolean> { |
| 469 | let stat |
no test coverage detected