Don't use relative! macro
This commit is contained in:
parent
fa0401b43c
commit
0fa76efc9d
1 changed files with 3 additions and 4 deletions
|
@ -13,9 +13,8 @@ pub mod util;
|
||||||
|
|
||||||
use dotenv::dotenv;
|
use dotenv::dotenv;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
use rocket::fs::{relative, FileServer};
|
use rocket::fs::FileServer;
|
||||||
use rocket::http::Method;
|
use rocket::http::Method;
|
||||||
use rocket_cors::{AllowedHeaders, AllowedOrigins, Cors};
|
use rocket_cors::{AllowedHeaders, AllowedOrigins, Cors};
|
||||||
|
|
||||||
|
@ -50,8 +49,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
|
||||||
let mut rocketship = rocket::build().attach(cors).mount("/", routes);
|
let mut rocketship = rocket::build().attach(cors).mount("/", routes);
|
||||||
|
|
||||||
let asset_path = relative!("assets");
|
let asset_path = std::env::current_dir().unwrap().join("assets");
|
||||||
if Path::new(asset_path).exists() {
|
if asset_path.exists() {
|
||||||
let fileserver = FileServer::from(asset_path);
|
let fileserver = FileServer::from(asset_path);
|
||||||
|
|
||||||
rocketship = rocketship.mount("/", fileserver);
|
rocketship = rocketship.mount("/", fileserver);
|
||||||
|
|
Loading…
Reference in a new issue