-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: A bug, incorrect or unintended behaviorCategory: A bug, incorrect or unintended behaviorCommand-serveCommand: serveCommand: serveE-Help-wantedExperience: Help NeededExperience: Help Needed
Description
Problem
HINT: cwd = current working directory
command mdbook
allows to serve a book from a different cwd like
# current cwd is path/to/repo
# book is path/to/repo/book
# we can call mdbook serve from repo root
mdbook serve book/
same works from an inner folder of the book folder like
# current cwd is path/to/repo/book/assets
# book is path/to/repo/book
# we can call mdbook serve from assets directory
mdbook serve ../book
but if we set configuration extra-watch-dirs
- the config is using the cwd
- not the root of the book.
[build]
extra-watch-dirs = [
"assets"
]
Case 1
- call
mdbook serve
from root of the repo
mdbook serve book/
error from output:
2023-07-03 02:54:31 [ERROR] (mdbook::cmd::serve): Unable to serve: panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/naxmefy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mdbook-0.4.30/src/cmd/watch.rs:133:39
Case 2
- call
mdbook serve
from assets directory
mdbook serve ../book
error from output:
2023-07-03 02:56:30 [ERROR] (mdbook::cmd::serve): Unable to serve: panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/naxmefy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mdbook-0.4.30/src/cmd/watch.rs:133:39
Case 3
- call
mdbook serve
from root of the book
mdbook serve
error from output: No Error
Additional info
If u set configuration to path the resolves the cwd to the target directory like
[build]
extra-watch-dirs = [
"book/assets"
]
or like
[build]
extra-watch-dirs = [
"../assets"
]
no error will be produced...but this is not expected.
Steps
- create a book
- add an extra directory
- add the configuration
extra-watch-dirs
- execute
mdbook serve
from an different folder than the root of the book
Possible Solution(s)
Just change the loading of extra-watch-dirs
from the root of the book like the src
configuration and not from the cwd
Notes
How I came to it?
I created a justfile
to run some book command from root and got the error
alias b := build
alias bb := book-build
alias bs := book-serve
build:
cargo build --release
book-build:
mdbook build book/
book-serve:
mdbook serve --open book/
Version
v0.4.30
Metadata
Metadata
Assignees
Labels
C-bugCategory: A bug, incorrect or unintended behaviorCategory: A bug, incorrect or unintended behaviorCommand-serveCommand: serveCommand: serveE-Help-wantedExperience: Help NeededExperience: Help Needed