(version: string, target: string, hash: string, mtimeOffset = 0)
| 18 | }); |
| 19 | |
| 20 | function makeHashDir(version: string, target: string, hash: string, mtimeOffset = 0): string { |
| 21 | const dir = join(root, 'native', version, target, hash); |
| 22 | mkdirSync(dir, { recursive: true }); |
| 23 | writeFileSync(join(dir, 'marker.txt'), hash); |
| 24 | const now = Math.floor(Date.now() / 1000); |
| 25 | utimesSync(dir, now + mtimeOffset, now + mtimeOffset); |
| 26 | return dir; |
| 27 | } |
| 28 | |
| 29 | it('keeps currentRoot + most recently modified sibling, deletes the rest', () => { |
| 30 | const v = '1.0.0'; |