Use a better default browser list and fail gracefully when css parsing fails (#3509)

This commit is contained in:
Evan Almloff authored and GitHub committed 2025-01-07 10:38:05 -08:00
1 parent 6071fde2c4
commit 807cfd29b7
4 files changed
+78 -12

No files matched your search

+9 -1
View File
@@ -1,5 +1,6 @@
use crate::{AppBundle, Platform, Result};
use anyhow::Context;
use dioxus_cli_opt::process_file_to;
use std::{
fs,
net::SocketAddr,
@@ -195,7 +196,14 @@ impl AppHandle {
// The asset might've been renamed thanks to the manifest, let's attempt to reload that too
if let Some(resource) = self.app.app.assets.assets.get(&changed_file).as_ref() {
let res = std::fs::copy(&changed_file, asset_dir.join(resource.bundled_path()));
let output_path = asset_dir.join(resource.bundled_path());
// Remove the old asset if it exists
_ = std::fs::remove_file(&output_path);
// And then process the asset with the options into the **old** asset location. If we recompiled,
// the asset would be in a new location because the contents and hash have changed. Since we are
// hotreloading, we need to use the old asset location it was originally written to.
let options = *resource.options();
let res = process_file_to(&options, &changed_file, &output_path);
bundled_name = Some(PathBuf::from(resource.bundled_path()));
if let Err(e) = res {
tracing::debug!("Failed to hotreload asset {e}");