diff options
Diffstat (limited to 'tools/first_light.py')
| -rw-r--r-- | tools/first_light.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/first_light.py b/tools/first_light.py index f54cc373f..2d6878afc 100644 --- a/tools/first_light.py +++ b/tools/first_light.py | |||
| @@ -64,6 +64,15 @@ def reset_run_folders(work: str) -> str: | |||
| 64 | """ | 64 | """ |
| 65 | base = os.path.join(work, "first_light") | 65 | base = os.path.join(work, "first_light") |
| 66 | real_base = os.path.join(os.path.realpath(work), "first_light") | 66 | real_base = os.path.join(os.path.realpath(work), "first_light") |
| 67 | # first_light itself is checked first: when it is a link to a folder with no dxbc or spirv in it, there is | ||
| 68 | # nothing stale to judge below, and the new dxbc would be created on the far side of the link. | ||
| 69 | if os.path.lexists(base) and ( | ||
| 70 | not os.path.isdir(base) or os.path.normcase(os.path.realpath(base)) != os.path.normcase(real_base) | ||
| 71 | ): | ||
| 72 | raise SystemExit( | ||
| 73 | f"{base} is a symlink, a junction or a file: each run removes and creates folders under it and does " | ||
| 74 | "not follow a link to do it; remove it and run again" | ||
| 75 | ) | ||
| 67 | stale = [os.path.join(base, name) for name in ("dxbc", "spirv") if os.path.lexists(os.path.join(base, name))] | 76 | stale = [os.path.join(base, name) for name in ("dxbc", "spirv") if os.path.lexists(os.path.join(base, name))] |
| 68 | for folder in stale: # both are checked before either is removed | 77 | for folder in stale: # both are checked before either is removed |
| 69 | real = os.path.join(real_base, os.path.basename(folder)) | 78 | real = os.path.join(real_base, os.path.basename(folder)) |