From 0fa76efc9d5ff3fb328645ee6ded4ce784d9e2d8 Mon Sep 17 00:00:00 2001 From: drobson03 <17976794+drobson03@users.noreply.github.com> Date: Mon, 4 Oct 2021 22:05:22 +1000 Subject: [PATCH] Don't use relative! macro --- src/main.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index be72519..23e4487 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,9 +13,8 @@ pub mod util; use dotenv::dotenv; use std::error::Error; -use std::path::Path; -use rocket::fs::{relative, FileServer}; +use rocket::fs::FileServer; use rocket::http::Method; use rocket_cors::{AllowedHeaders, AllowedOrigins, Cors}; @@ -50,8 +49,8 @@ async fn main() -> Result<(), Box> { let mut rocketship = rocket::build().attach(cors).mount("/", routes); - let asset_path = relative!("assets"); - if Path::new(asset_path).exists() { + let asset_path = std::env::current_dir().unwrap().join("assets"); + if asset_path.exists() { let fileserver = FileServer::from(asset_path); rocketship = rocketship.mount("/", fileserver);