Until Span::source_file() from the proc-macro crate becomes stable, any procedural macros that need to do filesystem operations will resolve paths relative to the current directory... but which directory is that?
Are there any guarantees about which directory a procedural macro will run in? And how does that interact with workspaces where the crate that consumes this macro may be compiled from its directory individually or at the same time as the entire workspace (cargo build --workspace)?
I'm not sure if I've understood the problem correctly, but the CARGO_MANIFEST_DIR environment variable might be useful? I'm not totally sure how it interacts with workspaces and such, but I've used it as the root path before to avoid dealing with relative paths.
A proc macro runs from whichever directory cargo invokes rustc. In the past this used to.be the package root, but it was changed to the workspace root to make error messages relative to the workspace root. I don't think there i sany guarantee that this won't change again in the future.
Oh yeah, you can use $CARGO_MANIFEST_DIR as an "anchor" to get a known useful path, but let's say I write something like diesel::embed_migrations!("./migrations/"). What is that migrations/ directory relative to?