Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #78 from Demonthos/crate_out_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mrxiaozhuox committed Oct 31, 2022
2 parents 3bac1ac + 16935bd commit 9c5b2cc
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 12 deletions.
52 changes: 52 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions src/cli/serve/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::*;
use std::{
fs::create_dir_all,
io::Write,
path::PathBuf,
process::{Command, Stdio},
Expand Down Expand Up @@ -71,19 +72,19 @@ impl Serve {
pub fn regen_dev_page(crate_config: &CrateConfig) -> Result<()> {
let serve_html = gen_page(&crate_config.dioxus_config, true);

let mut file = std::fs::File::create(
let dist_path = crate_config.crate_dir.join(
crate_config
.crate_dir
.join(
crate_config
.dioxus_config
.application
.out_dir
.clone()
.unwrap_or_else(|| PathBuf::from("dist")),
)
.join("index.html"),
)?;
.dioxus_config
.application
.out_dir
.clone()
.unwrap_or_else(|| PathBuf::from("dist")),
);
if !dist_path.is_dir() {
create_dir_all(&dist_path)?;
}
let index_path = dist_path.join("index.html");
let mut file = std::fs::File::create(index_path)?;
file.write_all(serve_html.as_bytes())?;

Ok(())
Expand Down

0 comments on commit 9c5b2cc

Please sign in to comment.