fix: polling noice on log and cache for scanning java version
This commit is contained in:
1 parent
7e5ff7f75f
commit
b5d98e5e8a
3 files changed
+47
-12
No files matched your search
@@ -49,6 +49,7 @@ pub struct SettingsState {
|
||||
meta_dir: PathBuf,
|
||||
active_profile: Option<String>,
|
||||
instance_name: Option<String>,
|
||||
java_key: Option<String>,
|
||||
java_source: Option<String>,
|
||||
java_label: String,
|
||||
}
|
||||
@@ -67,6 +68,7 @@ impl SettingsState {
|
||||
meta_dir,
|
||||
active_profile: None,
|
||||
instance_name: None,
|
||||
java_key: None,
|
||||
java_source: None,
|
||||
java_label: "unknown".to_string(),
|
||||
};
|
||||
@@ -110,12 +112,14 @@ impl SettingsState {
|
||||
self.select_active();
|
||||
}
|
||||
|
||||
let java_source = instance.map(effective_java_path);
|
||||
if self.java_source != java_source {
|
||||
let java_key = instance.map(java_path_key);
|
||||
if self.java_key != java_key {
|
||||
let java_source = instance.map(effective_java_path);
|
||||
self.java_label = java_source
|
||||
.as_deref()
|
||||
.map(java_version_label)
|
||||
.unwrap_or_else(|| "unknown".to_string());
|
||||
self.java_key = java_key;
|
||||
self.java_source = java_source;
|
||||
}
|
||||
}
|
||||
@@ -130,6 +134,16 @@ fn add_active_profile(profiles: &mut Vec<String>, active_profile: Option<&str>)
|
||||
}
|
||||
}
|
||||
|
||||
fn java_path_key(instance: &InstanceConfig) -> String {
|
||||
instance
|
||||
.java_path
|
||||
.as_deref()
|
||||
.filter(|path| !path.is_empty())
|
||||
.or_else(|| SETTINGS.paths.effective_java_path())
|
||||
.unwrap_or("<auto>")
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn effective_java_path(instance: &InstanceConfig) -> String {
|
||||
instance
|
||||
.java_path
|
||||
|
||||
Reference in new issue
Block a user