Fix the base path in the CLI (#2756)

This commit is contained in:
Evan Almloff authored and GitHub committed 2024-07-31 15:54:39 -07:00
1 parent 4bf71111c8
commit b8565e6de0
4 files changed
+37 -31

No files matched your search

+7 -12
View File
@@ -39,16 +39,7 @@ pub(crate) fn process_assets(
manifest: &AssetManifest,
progress: &mut UnboundedSender<UpdateBuildProgress>,
) -> anyhow::Result<()> {
let static_asset_output_dir = PathBuf::from(
config
.dioxus_config
.web
.app
.base_path
.clone()
.unwrap_or_default(),
);
let static_asset_output_dir = config.out_dir().join(static_asset_output_dir);
let static_asset_output_dir = config.out_dir();
std::fs::create_dir_all(&static_asset_output_dir)
.context("Failed to create static asset output directory")?;
@@ -96,10 +87,14 @@ pub(crate) fn process_assets(
pub(crate) struct AssetConfigDropGuard;
impl AssetConfigDropGuard {
pub fn new() -> Self {
pub fn new(base_path: Option<&str>) -> Self {
// Set up the collect asset config
let base = match base_path {
Some(base) => format!("/{}/", base.trim_matches('/')),
None => "/".to_string(),
};
manganis_cli_support::Config::default()
.with_assets_serve_location("/")
.with_assets_serve_location(&base)
.save();
Self {}
}