zola
zola copied to clipboard
Custom site root doesn't work on Windows
From the forums
Windows 10, zola 0.13.0
It appears the -r
flag is broken on Windows, at least with absolute links, like so:
zola.exe -r "D:\Dev\Zola\zola-clean-blog" build
This feels like https://github.com/getzola/zola/blob/master/src/main.rs#L15-L20 should work 🤔
Is it still happening with 0.14?
I had the same problem on master branch [0] and did a little analysis. It appears to me that (at least in my case) the problem might be that the windows canonical path looks like this:
root_dir: \?\C:\Users\user\my_site
My guess is the questionmark in the prefix will later be interpreted as a globbing character. Tera::parse will create no matches then.
I kinda confirmed this by removing the "canonicalize" call in the root_dir assignment, which fixed the problem for me.
let root_dir = match matches.value_of("root").unwrap() {
"." => env::current_dir().unwrap(),
path => PathBuf::from(path)
.canonicalize()
.unwrap_or_else(|_| panic!("Cannot find root directory: {}", path)),
};
[0] commit 9946506e1c363a35f097a7b220c613f77a989c43 (HEAD -> master, origin/master, origin/HEAD)
@warsus thanks for digging!
I can't remember why we're canonicalizing it to be honest. If you can do a PR with that change on the next
branch, I'll test on macos.
@Keats Sure i will try to do a PR later today. Also i think my assumption about the questionmark was not completly right. But i still think it's something about the \? prefix, might do some further digging in the tera lib afterwards.