docs: create leading directories for redirects
This will be useful when removing entire directories from the docs,
which will happen in an upcoming patch.
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7174>
diff --git a/docs/_exts/redirects.py b/docs/_exts/redirects.py
index eb5d082..0320f2c 100644
--- a/docs/_exts/redirects.py
+++ b/docs/_exts/redirects.py
@@ -15,6 +15,7 @@
return
for src, dst in redirects:
path = os.path.join(app.outdir, '{0}.html'.format(src))
+ os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, 'w') as f:
f.write(create_redirect(dst))