enhance: avoid failed hot-reload if backup file like .rs~ generate (#2048)
(cherry picked from commit 8565bca11b72b09d598bbbc9bb2ba77bab262db5) Co-authored-by: Jeremy Chen <jeremychen@djeremychen.com>
This commit is contained in:
1 parent
60235ac06b
commit
70f97ec787
1 file changed
+6
-1
@@ -47,8 +47,13 @@ async fn setup_file_watcher<F: Fn() -> Result<BuildResult> + Send + 'static>(
|
||||
|
||||
for path in &e.paths {
|
||||
// if this is not a rust file, rebuild the whole project
|
||||
if path.extension().and_then(|p| p.to_str()) != Some("rs") {
|
||||
let path_extension = path.extension().and_then(|p| p.to_str());
|
||||
if path_extension != Some("rs") {
|
||||
needs_full_rebuild = true;
|
||||
// if backup file generated will impact normal hot-reload, so ignore it
|
||||
if path_extension == Some("rs~") {
|
||||
needs_full_rebuild = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user