|
6 | 6 |
|
7 | 7 | import { platform, arch } from 'os'; |
8 | 8 | import { join, dirname } from 'path'; |
9 | | -import { existsSync, mkdirSync, createWriteStream, chmodSync } from 'fs'; |
| 9 | +import { existsSync, mkdirSync, createWriteStream, chmodSync, statSync } from 'fs'; |
10 | 10 | import { fileURLToPath } from 'url'; |
11 | 11 | import https from 'https'; |
12 | 12 |
|
13 | 13 | const __dirname = dirname(fileURLToPath(import.meta.url)); |
14 | 14 |
|
15 | | -const VERSION = '0.2.6'; |
| 15 | +const VERSION = '0.2.7'; |
16 | 16 | const REPO = 'aklo360/thoth-cli'; |
17 | 17 | const BASE_URL = `https://github.com/${REPO}/releases/download/v${VERSION}`; |
18 | 18 |
|
@@ -69,10 +69,14 @@ async function main() { |
69 | 69 | const binDir = join(__dirname, '..', 'bin', platformKey); |
70 | 70 | const binaryPath = join(binDir, binaryName); |
71 | 71 |
|
72 | | - // Skip if binary already exists |
| 72 | + // Skip if binary already exists AND has content |
73 | 73 | if (existsSync(binaryPath)) { |
74 | | - console.log(`✓ thoth-core binary already exists`); |
75 | | - return; |
| 74 | + const stats = statSync(binaryPath); |
| 75 | + if (stats.size > 0) { |
| 76 | + console.log(`✓ thoth-core binary already exists`); |
| 77 | + return; |
| 78 | + } |
| 79 | + console.log(`Found empty placeholder, downloading actual binary...`); |
76 | 80 | } |
77 | 81 |
|
78 | 82 | console.log(`Downloading thoth-core for ${platformKey}...`); |
|
0 commit comments