diff --git a/src/env/config_paths.rs b/src/env/config_paths.rs index cf7b0732a..7e0984123 100644 --- a/src/env/config_paths.rs +++ b/src/env/config_paths.rs @@ -140,7 +140,12 @@ fn from_exec_path(unresolved_exec_path: &'static FishPath) -> Self { sysconf: workspace_root.join("etc"), bin: Some(exec_path_parent.to_owned()), data: Some(workspace_root.join("share")), - doc: Some(workspace_root.join("user_doc/html")), + doc: if cfg!(use_prebuilt_docs) { + Some(workspace_root) + } else { + cfg!(using_cmake).then_some(Path::new(BUILD_DIR)) + } + .map(|p| p.join("user_doc/html")), } } else { FLOG!( diff --git a/tests/checks/config-paths.fish b/tests/checks/config-paths.fish index 340c3ca5c..8de52c08e 100644 --- a/tests/checks/config-paths.fish +++ b/tests/checks/config-paths.fish @@ -11,7 +11,7 @@ # NOTE: When our executable is located outside the build directory, these are different. # CHECKERR: config: paths.data: {{.*}}/share -# CHECKERR: config: paths.doc: {{.*}}/user_doc/html +# CHECKERR: config: paths.doc: {{.*/user_doc/html|\|not found\|}} # CHECKERR: config: sourcing {{.+}}/etc/config.fish # CHECKERR: config: not sourcing {{.*}}/xdg_config_home/fish/config.fish (not readable or does not exist)