From ce7f70ad7b00f5bbc7d1e9250dfc3bfdb0f4b018 Mon Sep 17 00:00:00 2001 From: blek Date: Sun, 29 Oct 2023 19:00:54 +1000 Subject: [PATCH] remove warp static dir in favor of static_dir! macro --- filed/src/web/mod.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/filed/src/web/mod.rs b/filed/src/web/mod.rs index e307f47..2fc92a3 100644 --- a/filed/src/web/mod.rs +++ b/filed/src/web/mod.rs @@ -2,8 +2,6 @@ web - The part of filed that handles everything related to HTTP */ -use std::env::current_dir; - use static_dir::static_dir; use warp::{Filter, reply::Reply, reject::Rejection}; @@ -19,15 +17,11 @@ mod uploaded; use state::SharedState; pub fn routes(state: SharedState) -> impl Filter + Clone { - let staticpath = current_dir().unwrap(); - let staticpath = staticpath.to_str().unwrap().to_string() + "/static"; - - pages::get_routes(state.clone()) + static_dir!("static") + .or(pages::get_routes(state.clone())) .or(forms::get_routes(state.clone())) .or(api::get_routes(state.clone())) .or(uploaded::get_uploaded(state)) - .or(static_dir!("static")) - .or(warp::fs::dir(staticpath.to_string())) } /*