XO1511: an embed.Dir has no file at this literal path
An embed.Dir’s keys are the files’ paths relative to the directory of the file that declares the constant, so const SITE: embed.Dir = embed("static") holds static/index.html, not index.html, and SITE.read("index.html") gives None: a server that serves the result shows a blank page. When one key ends with the path, the warning offers it as a fix and notes that SITE.sub("static") drops the prefix. A path computed at run time is not checked, and the call is not an error because its result is an Option.
Example
const SITE: embed.Dir = embed("static")
fn page() -> Bytes { SITE.read("index.html") ?? b"" }Fix
const SITE: embed.Dir = embed("static")
fn page() -> Bytes { SITE.read("static/index.html") ?? b"" }Run xo explain XO1511 for this text in a terminal, or see
section 10.6 of the specification.