Fix UI directory detection: skip filesystem checks when embed-ui is enabled
This commit is contained in:
parent
77374ae638
commit
abdd2ff615
1 changed files with 29 additions and 22 deletions
|
|
@ -224,30 +224,37 @@ pub async fn index(OriginalUri(uri): OriginalUri) -> Response {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_ui_root() -> PathBuf {
|
pub fn get_ui_root() -> PathBuf {
|
||||||
let candidates = [
|
#[cfg(feature = "embed-ui")]
|
||||||
"ui",
|
{
|
||||||
"botui/ui",
|
PathBuf::from("ui")
|
||||||
"../botui/ui",
|
|
||||||
"../../botui/ui",
|
|
||||||
"../../../botui/ui",
|
|
||||||
];
|
|
||||||
|
|
||||||
for path_str in candidates {
|
|
||||||
let path = PathBuf::from(path_str);
|
|
||||||
if path.exists() {
|
|
||||||
info!("Found UI root at: {:?}", path);
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to "ui" but log a warning
|
#[cfg(not(feature = "embed-ui"))]
|
||||||
let default = PathBuf::from("ui");
|
{
|
||||||
error!(
|
let candidates = [
|
||||||
"Could not find 'ui' directory in candidates: {:?}. Defaulting to 'ui' (CWD: {:?})",
|
"ui",
|
||||||
candidates,
|
"botui/ui",
|
||||||
std::env::current_dir()
|
"../botui/ui",
|
||||||
);
|
"../../botui/ui",
|
||||||
default
|
"../../../botui/ui",
|
||||||
|
];
|
||||||
|
|
||||||
|
for path_str in candidates {
|
||||||
|
let path = PathBuf::from(path_str);
|
||||||
|
if path.exists() {
|
||||||
|
info!("Found UI root at: {:?}", path);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let default = PathBuf::from("ui");
|
||||||
|
error!(
|
||||||
|
"Could not find 'ui' directory in candidates: {:?}. Defaulting to 'ui' (CWD: {:?})",
|
||||||
|
candidates,
|
||||||
|
std::env::current_dir()
|
||||||
|
);
|
||||||
|
default
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn serve_minimal() -> impl IntoResponse {
|
pub async fn serve_minimal() -> impl IntoResponse {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue