| 361 | | auto progname = std.path.join(tmpDir, |
|---|
| 362 | | "rdmd_eval" ~ digestToString(digest) ~ ".d"); |
|---|
| 363 | | |
|---|
| 364 | | std.file.write(progname, todo); |
|---|
| 365 | | scope(exit) std.file.remove(progname); |
|---|
| 366 | | run("dmd -run " ~ progname); |
|---|
| | 362 | auto pathname = std.path.join(tmpDir, ".rdmd"); |
|---|
| | 363 | if (!exists(pathname)) mkdirRecurse(pathname); |
|---|
| | 364 | auto progname = std.path.join(pathname, |
|---|
| | 365 | "eval." ~ digestToString(digest)); |
|---|
| | 366 | |
|---|
| | 367 | if (exists(progname) || |
|---|
| | 368 | // Compile it |
|---|
| | 369 | (std.file.write(progname~".d", todo), |
|---|
| | 370 | run("dmd " ~ progname ~ ".d -of" ~ progname) == 0)) |
|---|
| | 371 | { |
|---|
| | 372 | // It's there, just run it |
|---|
| | 373 | run(progname); |
|---|
| | 374 | } |
|---|
| | 375 | |
|---|
| | 376 | // Clean pathname |
|---|
| | 377 | enum lifetimeInHours = 24; |
|---|
| | 378 | auto cutoff = getUTCtime - 60 * 60 * lifetimeInHours * TicksPerSecond; |
|---|
| | 379 | foreach (DirEntry d; dirEntries(pathname, SpanMode.shallow)) |
|---|
| | 380 | { |
|---|
| | 381 | if (d.lastWriteTime < cutoff) |
|---|
| | 382 | { |
|---|
| | 383 | std.file.remove(d.name); |
|---|
| | 384 | //break; // only one per call so we don't waste time |
|---|
| | 385 | } |
|---|
| | 386 | } |
|---|
| | 387 | |
|---|